diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ng/directive/ngBind.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/ng/directive/ngBind.js b/src/ng/directive/ngBind.js index de374574..64a2d821 100644 --- a/src/ng/directive/ngBind.js +++ b/src/ng/directive/ngBind.js @@ -134,11 +134,15 @@ var ngBindTemplateDirective = ['$interpolate', function($interpolate) { * @element ANY * @param {expression} ngBindHtml {@link guide/expression Expression} to evaluate. */ -var ngBindHtmlDirective = ['$sce', function($sce) { +var ngBindHtmlDirective = ['$sce', '$parse', function($sce, $parse) { return function(scope, element, attr) { element.addClass('ng-binding').data('$binding', attr.ngBindHtml); - scope.$watch(attr.ngBindHtml, function ngBindHtmlWatchAction(value) { - element.html($sce.getTrustedHtml(value) || ''); + + var parsed = $parse(attr.ngBindHtml); + function getStringValue() { return (parsed(scope) || '').toString(); } + + scope.$watch(getStringValue, function ngBindHtmlWatchAction(value) { + element.html($sce.getTrustedHtml(parsed(scope)) || ''); }); }; }]; |
