refactor(forms): extract Validators.required into a variable as transformers cannot resolve statics

This commit is contained in:
vsavkin 2016-03-16 11:46:31 -07:00 committed by Victor Savkin
parent 0dbf959548
commit d23b973e7a
1 changed files with 3 additions and 1 deletions

View File

@ -26,8 +26,10 @@ import {NumberWrapper} from "angular2/src/facade/lang";
*/
export interface Validator { validate(c: modelModule.AbstractControl): {[key: string]: any}; }
const REQUIRED = Validators.required;
const REQUIRED_VALIDATOR =
CONST_EXPR(new Provider(NG_VALIDATORS, {useValue: Validators.required, multi: true}));
CONST_EXPR(new Provider(NG_VALIDATORS, {useValue: REQUIRED, multi: true}));
/**
* A Directive that adds the `required` validator to any controls marked with the