Prachi Bhandari Prachi Bhandari - 1 year ago 63
AngularJS Question

Why my modal refreshes each time in Angularjs while calling $http.get() method in angular?

I have two way data binding in my angularJS page and when I call

I can examine that all the modal values are updated again. Since
is asynchronous I should simply get the result from API instead of entire bindings in view. Can somebody explain this cause?

Answer Source

This is the common behavior in AngularJS. When you call $http.get() method it execute $rootscope.$apply() which will trigger the $digest cycle and hence all the modal are checked and updated in case they are dirty. For optimization use one way binding in the modal that you think need to updated only once.