Call A Function In A Controller In Another Module In Angularjs
I am having trouble calling a function in another controller that is in another module. I don't know if this is possible, but this is what I have now: angular.module('search.contro
Solution 1:
Controllers can't be injected, so it simple does not work. You need to create a service with your function and inject this service.
If you need to exchange data between controllers the best option is to use events but your controllers need to be nested in order to communicate via scopes.
One last resource should use rootScope and watch for a value, but its not recommended to do it.
Post a Comment for "Call A Function In A Controller In Another Module In Angularjs"