What I wanted to know was when I call say $scope.$apply within a specific controller, are all the scope variables in all other controller with currently active views in the given angular app module also refreshed or only the scope variables in that particular controller?
Asked
Active
Viewed 72 times
0
-
maybe could help http://stackoverflow.com/questions/15112584/using-scope-watch-and-scope-apply-in-angularjs – Jorge Guerola Mar 30 '16 at 14:42
1 Answers
2
Looking at the source code.
$apply: function(expr) {
try {
beginPhase('$apply');
try {
return this.$eval(expr);
} finally {
clearPhase();
}
} catch (e) {
$exceptionHandler(e);
} finally {
try {
$rootScope.$digest();
} catch (e) {
$exceptionHandler(e);
throw e;
}
}
},
The $apply
function triggers a $digest
on $rootScope
. This means all the watch functions of the entire app get evaluated.

georgeawg
- 48,608
- 13
- 72
- 95