aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/directives.js2
-rw-r--r--test/directivesSpec.js6
2 files changed, 7 insertions, 1 deletions
diff --git a/src/directives.js b/src/directives.js
index 10d1f1e5..104ff9c8 100644
--- a/src/directives.js
+++ b/src/directives.js
@@ -210,7 +210,7 @@ angularDirective("ng:bind", function(expression, element){
element.html('');
element.append(value);
} else {
- element.text(value === _undefined ? '' : value);
+ element.text(value == _undefined ? '' : value);
}
}
}, element);
diff --git a/test/directivesSpec.js b/test/directivesSpec.js
index ef8241f1..caf0bc15 100644
--- a/test/directivesSpec.js
+++ b/test/directivesSpec.js
@@ -80,6 +80,12 @@ describe("directive", function(){
expect(sortedHtml(scope.$element)).toEqual('<div>before<div class="filter" ng:bind="0|myFilter">HELLO</div>after</div>');
});
+
+ it('should suppress rendering of falsy values', function(){
+ var scope = compile('<div>{{ null }}{{ undefined }}{{ "" }}-{{ 0 }}{{ false }}</div>');
+ expect(scope.$element.text()).toEqual('-0false');
+ });
+
});
describe('ng:bind-template', function(){