diff options
| -rw-r--r-- | src/widget/input.js | 2 | ||||
| -rw-r--r-- | test/widget/inputSpec.js | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/widget/input.js b/src/widget/input.js index 854f8b06..5268f1a7 100644 --- a/src/widget/input.js +++ b/src/widget/input.js @@ -382,7 +382,7 @@ function textInputType(scope, element, attr, ctrl) { }); ctrl.render = function() { - element.val(ctrl.viewValue || ''); + element.val(isEmpty(ctrl.viewValue) ? '' : ctrl.viewValue); }; // pattern validator diff --git a/test/widget/inputSpec.js b/test/widget/inputSpec.js index d8e88d2b..e4df4fa5 100644 --- a/test/widget/inputSpec.js +++ b/test/widget/inputSpec.js @@ -334,6 +334,16 @@ describe('input', function() { }); + it('should render 0 even if it is a number', function() { + compileInput('<input type="text" ng:model="value" />'); + scope.$apply(function() { + scope.value = 0; + }); + + expect(inputElm.val()).toBe('0'); + }); + + describe('pattern', function() { it('should validate in-lined pattern', function() { |
