diff options
| author | Igor Minar | 2012-04-08 02:49:03 -0700 |
|---|---|---|
| committer | Igor Minar | 2012-04-09 09:52:28 -0700 |
| commit | 10daefc6f466a21d9418437666461c80cf24fcfe (patch) | |
| tree | 1d2e18314467229f3a2fd1fc95981a4c5704ff51 /src | |
| parent | dc7b764d4da500682799234b32b6bd44e73c5d41 (diff) | |
| download | angular.js-10daefc6f466a21d9418437666461c80cf24fcfe.tar.bz2 | |
fix(ngBindHtml): clear contents when model is falsy
Closes #864
Diffstat (limited to 'src')
| -rw-r--r-- | src/ng/directive/ngBind.js | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/ng/directive/ngBind.js b/src/ng/directive/ngBind.js index 3c4a7d43..4f6d49aa 100644 --- a/src/ng/directive/ngBind.js +++ b/src/ng/directive/ngBind.js @@ -73,7 +73,7 @@ var ngBindDirective = ngDirective(function(scope, element, attr) { var ngBindHtmlUnsafeDirective = ngDirective(function(scope, element, attr) { element.addClass('ng-binding').data('$binding', attr.ngBindHtmlUnsafe); scope.$watch(attr.ngBindHtmlUnsafe, function(value) { - element.html(value == undefined ? '' : value); + element.html(value || ''); }); }); @@ -96,9 +96,8 @@ var ngBindHtmlDirective = ['$sanitize', function($sanitize) { return function(scope, element, attr) { element.addClass('ng-binding').data('$binding', attr.ngBindHtml); scope.$watch(attr.ngBindHtml, function(value) { - if (value = $sanitize(value)) { - element.html(value); - } + value = $sanitize(value); + element.html(value || ''); }); } }]; |
