Question

I am trying to broadcast a message from legacy javascript function into Angular controller(s) via a Angular service. Broadcasting works fine when called within Angular, but not outside. See http://jsfiddle.net/yh3Ds/24/

Was it helpful?

Solution

It seems that angular.injector() is creating new module instance and it is independent from the module instance bound with the html via ng-app attribute.

So solution is to use manual bootstrap and obtain the injector there. Use this injector you can access the service instance and $rootScope which is actually controlling the view.

Here is the updated fiddle; http://jsfiddle.net/d8vX3/1/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top