Skip to content

Commit

Permalink
perf(ngBindHtml): watch the original value and sanitize later
Browse files Browse the repository at this point in the history
  • Loading branch information
chirayuk authored and jamesdaily committed Sep 25, 2013
1 parent 03fbbf3 commit c86d23a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ng/directive/ngBind.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ var ngBindTemplateDirective = ['$interpolate', function($interpolate) {
var ngBindHtmlDirective = ['$sce', function($sce) {
return function(scope, element, attr) {
element.addClass('ng-binding').data('$binding', attr.ngBindHtml);
scope.$watch($sce.parseAsHtml(attr.ngBindHtml), function ngBindHtmlWatchAction(value) {
element.html(value || '');
scope.$watch(attr.ngBindHtml, function ngBindHtmlWatchAction(value) {
element.html($sce.getTrustedHtml(value) || '');
});
};
}];

0 comments on commit c86d23a

Please sign in to comment.