diff options
| author | Daniel Luz | 2012-11-04 19:11:24 -0200 | 
|---|---|---|
| committer | Misko Hevery | 2013-02-14 14:43:56 -0800 | 
| commit | 1d7a95df565192fc02a18b0b297b39dd615eaeb5 (patch) | |
| tree | 9a307559c483251b40e500739ce96db85731712f /src/ng/rootScope.js | |
| parent | 1ed638582d2f2c7f89384d9712f4cfac52cc5b70 (diff) | |
| download | angular.js-1d7a95df565192fc02a18b0b297b39dd615eaeb5.tar.bz2 | |
feat(scope): only evaluate constant $watch expressions once
Diffstat (limited to 'src/ng/rootScope.js')
| -rw-r--r-- | src/ng/rootScope.js | 8 | 
1 files changed, 8 insertions, 0 deletions
| diff --git a/src/ng/rootScope.js b/src/ng/rootScope.js index b6a582bc..866b957e 100644 --- a/src/ng/rootScope.js +++ b/src/ng/rootScope.js @@ -300,6 +300,14 @@ function $RootScopeProvider(){            watcher.fn = function(newVal, oldVal, scope) {listenFn(scope);};          } +        if (typeof watchExp == 'string' && get.constant) { +          var originalFn = watcher.fn; +          watcher.fn = function(newVal, oldVal, scope) { +            originalFn.call(this, newVal, oldVal, scope); +            arrayRemove(array, watcher); +          }; +        } +          if (!array) {            array = scope.$$watchers = [];          } | 
