3

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

1 Answer 1

2

Look into Scope.$apply(). From that page:

$apply() is used to execute an expression in angular from outside of the angular framework.

Sign up to request clarification or add additional context in comments.

3 Comments

Yes, thank you, that worked. Found more information on usage here - stackoverflow.com/questions/10490570/…
You may be able to go more efficient (if you wish) by doing a $compile.
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.