-
Notifications
You must be signed in to change notification settings - Fork 65
How do I use the methods inside dynamically added file? #9
Comments
Thanks, the library does not deal with this. One way you can achieve this is by manually querying the AngularJS injector from within the loaded script files:
This should do the trick and fetch an instance of a service called |
Thanks Uri. If i try to use your command I get this error. The trouble is there is no way to register the service beforehand as a dependency with my controller as it is loaded only after bootstrap. Let me know if you have any ideas. |
Finally cracked it! the trick is to run your service inside an ngApp on the head. And manually bootstrap another ng-app on the body with all the dependencies wired in. Also, could you help create a version where I pass an array of srcs and all the files get attached? |
@hags37 Perhaps you can create a small plunkr/pull request with an example, for the benefit of future users? We can then put it into an 'examples' directory inside the repository... Thanks! |
http://plnkr.co/edit/QrjykCQmm9PHzMRRY43b For the sake of the plunker, i copied snippets from your code. But the general usage of your library is solid. |
This library is neat. But I have a question - how do I use the services inside a newly loaded angular file? They don't seem to be available for injection. thoughts?
The text was updated successfully, but these errors were encountered: