A way to interact with Angular controller from "outside the Angular world". The quoted code can be called from JavaScript in a page. It, basically, gets the related scope from an HTML element and then the interaction is easy.
Integrating Angular with legacy code - JSFiddle:
Integrating Angular with legacy code - JSFiddle:
angular.element($("#microController-div")).scope().incrementDataInService();Even easier variant would be to avoid using jQuery:
var scope = angular.element("#myelement").scope();
No comments:
Post a Comment