mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-21 21:01:51 +00:00
perf(ngBindHtml): watch the original value and sanitize later
This commit is contained in:
parent
baaa73ee1e
commit
068d8615d2
1 changed files with 2 additions and 2 deletions
|
|
@ -136,8 +136,8 @@ var ngBindTemplateDirective = ['$interpolate', function($interpolate) {
|
||||||
var ngBindHtmlDirective = ['$sce', function($sce) {
|
var ngBindHtmlDirective = ['$sce', function($sce) {
|
||||||
return function(scope, element, attr) {
|
return function(scope, element, attr) {
|
||||||
element.addClass('ng-binding').data('$binding', attr.ngBindHtml);
|
element.addClass('ng-binding').data('$binding', attr.ngBindHtml);
|
||||||
scope.$watch($sce.parseAsHtml(attr.ngBindHtml), function ngBindHtmlWatchAction(value) {
|
scope.$watch(attr.ngBindHtml, function ngBindHtmlWatchAction(value) {
|
||||||
element.html(value || '');
|
element.html($sce.getTrustedHtml(value) || '');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}];
|
}];
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue