diff options
| author | Misko Hevery | 2012-02-21 17:05:43 -0800 | 
|---|---|---|
| committer | Misko Hevery | 2012-02-21 22:46:01 -0800 | 
| commit | 656a495e503bc0a5a8e1b2da0169e6d2bf0f31f1 (patch) | |
| tree | 248952b732bdfd80e33e55e57eb56ac82ae91f26 /src/directives.js | |
| parent | 6d0ca95fa05ea6c7bcaef5c1d5a03fa67a6b6d0c (diff) | |
| download | angular.js-656a495e503bc0a5a8e1b2da0169e6d2bf0f31f1.tar.bz2 | |
refactor(directive): use attrs.$observe
Diffstat (limited to 'src/directives.js')
| -rw-r--r-- | src/directives.js | 12 | 
1 files changed, 6 insertions, 6 deletions
diff --git a/src/directives.js b/src/directives.js index 39308b1a..1f70d912 100644 --- a/src/directives.js +++ b/src/directives.js @@ -253,10 +253,10 @@ var ngBindHtmlDirective = ['$sanitize', function($sanitize) {   */  var ngBindTemplateDirective = ['$interpolate', function($interpolate) {    return function(scope, element, attr) { -    var interpolateFn = $interpolate(attr.ngBindTemplate); +    // TODO: move this to scenario runner      var interpolateFn = $interpolate(element.attr(attr.$attr.ngBindTemplate));      element.addClass('ng-binding').data('$binding', interpolateFn); -    scope.$watch(interpolateFn, function(value) { +    attr.$observe('ngBindTemplate', function(value) {        element.text(value);      });    } @@ -901,13 +901,13 @@ var ngCloakDirective = valueFn({  });  function ngAttributeAliasDirective(propName, attrName) { -  ngAttributeAliasDirectives[directiveNormalize('ng-' + attrName)] = ['$interpolate', function($interpolate) { -    return function(scope, element, attr) { -      scope.$watch($interpolate(attr[directiveNormalize('ng-' + attrName)]), function(value) { +  ngAttributeAliasDirectives[directiveNormalize('ng-' + attrName)] = valueFn( +    function(scope, element, attr) { +      attr.$observe(directiveNormalize('ng-' + attrName), function(value) {          attr.$set(attrName, value);        });      } -  }]; +  );  }  var ngAttributeAliasDirectives = {};  forEach(BOOLEAN_ATTR, ngAttributeAliasDirective);  | 
