1

I would like to know if it is possible to get a particular factory object dynamically (without using dependancy injection). So if I have the module name and the factory name can I do something to retrieve the factory object itself?

Edit: $provide and $injector might be in the right direction?

Luke Deighton
  • 328
  • 2
  • 10
  • Can you provide more of a view into the purpose behind it? I think I know how to answer your question, but I can't think of any good reason to do what you're asking for. So I'm wondering if maybe there's a better answer, if I knew why you wanted to get the factory object – tennisgent Oct 09 '14 at 16:10
  • My problem is with using Cordova/PhoneGap with AngularJS. AngulasJS sets up all the modules before a lot of plugins are ready (eg. File/Database plugins). I had an idea to have a utility method that can search all factories with a function called "onDeviceReady" and call it once Cordova is ready. I suppose there isn't really a strong case for doing so but I'm still learning AngularJS and curious about it :) – Luke Deighton Oct 09 '14 at 22:08

1 Answers1

0

Based on your comment above:

This problem has been solved by numerous people. Angular has built-in support for manually bootstrapping an app whenever you're good and ready. There are a bunch of online tutorials for how to do this. However, the answer to your specific problem can be found in the following SO post:

Cordova + Angularjs + Device Ready

Hope that helps.

Community
  • 1
  • 1
tennisgent
  • 14,165
  • 9
  • 50
  • 48
  • thanks for your answer, I'm using Ionic that sits on top of AngularJS so it doesn't expose the ng-app attribute. I'll have to look into how to do this with Ionic. – Luke Deighton Oct 09 '14 at 22:21
  • This guy seems to have figured it out: http://www.raymondcamden.com/2014/8/16/Ionic-and-Cordovas-DeviceReady--My-Solution – tennisgent Oct 10 '14 at 13:56