perf(ngBindHtml): watch the original value and sanitize later

This commit is contained in:
Chirayu Krishnappa 2013-08-29 12:47:51 -07:00
parent baaa73ee1e
commit 068d8615d2

View file

@ -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) || '');
});
};
}];