0

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?

Rohit Rane
  • 2,790
  • 6
  • 25
  • 41

1 Answers1

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