문제

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/

도움이 되었습니까?

해결책

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/

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top