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?
1 Answer
Look into Scope.$apply(). From that page:
$apply() is used to execute an expression in angular from outside of the angular framework.
3 Comments
Nikhil Baliga
Yes, thank you, that worked. Found more information on usage here - stackoverflow.com/questions/10490570/…
Daniel
You may be able to go more efficient (if you wish) by doing a $compile.
Daniel
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): youtube.com/watch?v=iB7hfvqyZpg