The $apply
function can run on any scope, including $rootScope
.
Are there cases when it makes a difference if I run it on my local scope or
Another reason for running $apply
on the $rootScope
instead of $scope
typically comes for me when I need to call $apply
in a service which will be used by different controllers and therefore different scopes.
In this cases I prefer to inject the $rootScope
to the service and call $apply on it without worrying on which scopes the service will be used in the future.