feat(forms): export validator directives as part of formDirectives

This commit is contained in:
vsavkin 2015-06-05 14:31:03 -07:00
parent 5fc23caef7
commit 73bce40287
2 changed files with 6 additions and 3 deletions

View File

@ -8,6 +8,7 @@ import {TemplateDrivenFormDirective} from './directives/template_driven_form_dir
import {DefaultValueAccessor} from './directives/default_value_accessor'; import {DefaultValueAccessor} from './directives/default_value_accessor';
import {CheckboxControlValueAccessor} from './directives/checkbox_value_accessor'; import {CheckboxControlValueAccessor} from './directives/checkbox_value_accessor';
import {SelectControlValueAccessor} from './directives/select_control_value_accessor'; import {SelectControlValueAccessor} from './directives/select_control_value_accessor';
import {RequiredValidatorDirective} from './validator_directives';
export {ControlNameDirective} from './directives/control_name_directive'; export {ControlNameDirective} from './directives/control_name_directive';
export {FormControlDirective} from './directives/form_control_directive'; export {FormControlDirective} from './directives/form_control_directive';
@ -20,6 +21,7 @@ export {ControlValueAccessor} from './directives/control_value_accessor';
export {DefaultValueAccessor} from './directives/default_value_accessor'; export {DefaultValueAccessor} from './directives/default_value_accessor';
export {CheckboxControlValueAccessor} from './directives/checkbox_value_accessor'; export {CheckboxControlValueAccessor} from './directives/checkbox_value_accessor';
export {SelectControlValueAccessor} from './directives/select_control_value_accessor'; export {SelectControlValueAccessor} from './directives/select_control_value_accessor';
export {RequiredValidatorDirective} from './validator_directives';
/** /**
* *
@ -40,5 +42,7 @@ export const formDirectives: List<Type> = CONST_EXPR([
DefaultValueAccessor, DefaultValueAccessor,
CheckboxControlValueAccessor, CheckboxControlValueAccessor,
SelectControlValueAccessor SelectControlValueAccessor,
RequiredValidatorDirective
]); ]);

View File

@ -24,7 +24,6 @@ import {NgIf} from 'angular2/directives';
import { import {
Control, Control,
ControlGroup, ControlGroup,
RequiredValidatorDirective,
TemplateDrivenFormDirective, TemplateDrivenFormDirective,
formDirectives, formDirectives,
Validators, Validators,
@ -752,7 +751,7 @@ class WrappedValue implements ControlValueAccessor {
} }
@Component({selector: "my-comp"}) @Component({selector: "my-comp"})
@View({directives: [formDirectives, WrappedValue, RequiredValidatorDirective, NgIf]}) @View({directives: [formDirectives, WrappedValue, NgIf]})
class MyComp { class MyComp {
form: any; form: any;
name: string; name: string;