I have some data that I am retrieving outside of AngularJS scope. I want to use this data to update the model inside Angular so that it reflects in the views as well, and thereafter work like how Angular should work. How do I push this data in?
Asked
Active
Viewed 353 times
3
-
possible duplicate of [Call Angular JS from legacy code](http://stackoverflow.com/questions/10490570/call-angular-js-from-legacy-code) – Jeremy Mar 26 '13 at 20:35
1 Answers
2
Look into Scope.$apply(). From that page:
$apply() is used to execute an expression in angular from outside of the angular framework.

Justen
- 4,859
- 9
- 44
- 68
-
1Yes, thank you, that worked. Found more information on usage here - http://stackoverflow.com/questions/10490570/call-angular-js-from-legacy-code – Nikhil Baliga Nov 04 '12 at 08:42
-
You may be able to go more efficient (if you wish) by doing a $compile. – Daniel Nov 22 '12 at 02:14
-
Specifically, if it's html data, you can call $compile on your injected html and linking that to your scope. Check out this video (starting at 39:05): http://www.youtube.com/watch?v=iB7hfvqyZpg – Daniel Nov 22 '12 at 02:21