diff options
| author | Tobias Bosch | 2013-10-31 11:13:56 -0700 | 
|---|---|---|
| committer | Tobias Bosch | 2013-10-31 12:56:49 -0700 | 
| commit | 9a828738cd2e959bc2a198989e96c8e416d28b71 (patch) | |
| tree | e555642081107bd15b079d31487af5bac54d480b /src/ng/directive/ngEventDirs.js | |
| parent | 3d6a89e8888b14ae5cb5640464e12b7811853c7e (diff) | |
| download | angular.js-9a828738cd2e959bc2a198989e96c8e416d28b71.tar.bz2 | |
fix(ngEventDirectives): parse expression only once during compile phase.
Diffstat (limited to 'src/ng/directive/ngEventDirs.js')
| -rw-r--r-- | src/ng/directive/ngEventDirs.js | 18 | 
1 files changed, 11 insertions, 7 deletions
diff --git a/src/ng/directive/ngEventDirs.js b/src/ng/directive/ngEventDirs.js index bc4222e0..a76102c0 100644 --- a/src/ng/directive/ngEventDirs.js +++ b/src/ng/directive/ngEventDirs.js @@ -41,13 +41,17 @@ forEach(    function(name) {      var directiveName = directiveNormalize('ng-' + name);      ngEventDirectives[directiveName] = ['$parse', function($parse) { -      return function(scope, element, attr) { -        var fn = $parse(attr[directiveName]); -        element.on(lowercase(name), function(event) { -          scope.$apply(function() { -            fn(scope, {$event:event}); -          }); -        }); +      return { +        compile: function($element, attr) { +          var fn = $parse(attr[directiveName]); +          return function(scope, element, attr) { +            element.on(lowercase(name), function(event) { +              scope.$apply(function() { +                fn(scope, {$event:event}); +              }); +            }); +          }; +        }        };      }];    }  | 
