From d23b973e7af272a4bc4eefbf38d154905b53a733 Mon Sep 17 00:00:00 2001 From: vsavkin Date: Wed, 16 Mar 2016 11:46:31 -0700 Subject: [PATCH] refactor(forms): extract Validators.required into a variable as transformers cannot resolve statics --- modules/angular2/src/common/forms/directives/validators.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/angular2/src/common/forms/directives/validators.ts b/modules/angular2/src/common/forms/directives/validators.ts index 9851989045..27bdf3a87f 100644 --- a/modules/angular2/src/common/forms/directives/validators.ts +++ b/modules/angular2/src/common/forms/directives/validators.ts @@ -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