fix(Validators): fix Validators.required marking number zero as invalid
Closes #6617
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import {isBlank, isPresent, CONST_EXPR} from 'angular2/src/facade/lang';
|
||||
import {isBlank, isPresent, CONST_EXPR, isString} from 'angular2/src/facade/lang';
|
||||
import {PromiseWrapper} from 'angular2/src/facade/promise';
|
||||
import {ObservableWrapper} from 'angular2/src/facade/async';
|
||||
import {ListWrapper, StringMapWrapper} from 'angular2/src/facade/collection';
|
||||
@ -44,7 +44,9 @@ export class Validators {
|
||||
* Validator that requires controls to have a non-empty value.
|
||||
*/
|
||||
static required(control: modelModule.Control): {[key: string]: boolean} {
|
||||
return isBlank(control.value) || control.value == "" ? {"required": true} : null;
|
||||
return isBlank(control.value) || (isString(control.value) && control.value == "") ?
|
||||
{"required": true} :
|
||||
null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user