fix(input): Render 0 (number) as 0 (not empty string)

This commit is contained in:
Vojta Jina 2012-02-25 22:38:18 -08:00
parent c4c60c25b4
commit e7d6106811
2 changed files with 11 additions and 1 deletions

View file

@ -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

View file

@ -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() {