diff --git a/modules/@angular/common/src/forms.ts b/modules/@angular/common/src/forms.ts index 71e0828532..7acbbe1e5a 100644 --- a/modules/@angular/common/src/forms.ts +++ b/modules/@angular/common/src/forms.ts @@ -16,21 +16,21 @@ import {Type} from '@angular/core'; import {RadioControlRegistry} from './forms/directives/radio_control_value_accessor'; import {FormBuilder} from './forms/form_builder'; -export {FORM_DIRECTIVES, RadioButtonState} from './forms/directives'; +export {FORM_DIRECTIVES, REACTIVE_FORM_DIRECTIVES, RadioButtonState} from './forms/directives'; export {AbstractControlDirective} from './forms/directives/abstract_control_directive'; export {CheckboxControlValueAccessor} from './forms/directives/checkbox_value_accessor'; export {ControlContainer} from './forms/directives/control_container'; export {ControlValueAccessor, NG_VALUE_ACCESSOR} from './forms/directives/control_value_accessor'; export {DefaultValueAccessor} from './forms/directives/default_value_accessor'; -export {FormControlDirective} from './forms/directives/form_control_directive'; export {Form} from './forms/directives/form_interface'; export {NgControl} from './forms/directives/ng_control'; export {NgControlGroup} from './forms/directives/ng_control_group'; export {NgControlName} from './forms/directives/ng_control_name'; export {NgControlStatus} from './forms/directives/ng_control_status'; export {NgForm} from './forms/directives/ng_form'; -export {NgFormModel} from './forms/directives/ng_form_model'; export {NgModel} from './forms/directives/ng_model'; +export {FormControlDirective} from './forms/directives/reactive_directives/form_control_directive'; +export {FormGroupDirective} from './forms/directives/reactive_directives/form_group_directive'; export {NgSelectOption, SelectControlValueAccessor} from './forms/directives/select_control_value_accessor'; export {MaxLengthValidator, MinLengthValidator, PatternValidator, RequiredValidator, Validator} from './forms/directives/validators'; export {FormBuilder} from './forms/form_builder'; diff --git a/modules/@angular/common/src/forms/directives.ts b/modules/@angular/common/src/forms/directives.ts index 9ba4ab936f..0cc0993951 100644 --- a/modules/@angular/common/src/forms/directives.ts +++ b/modules/@angular/common/src/forms/directives.ts @@ -2,15 +2,15 @@ import {Type} from '@angular/core'; import {CheckboxControlValueAccessor} from './directives/checkbox_value_accessor'; import {DefaultValueAccessor} from './directives/default_value_accessor'; -import {FormControlDirective} from './directives/form_control_directive'; import {NgControlGroup} from './directives/ng_control_group'; import {NgControlName} from './directives/ng_control_name'; import {NgControlStatus} from './directives/ng_control_status'; import {NgForm} from './directives/ng_form'; -import {NgFormModel} from './directives/ng_form_model'; import {NgModel} from './directives/ng_model'; import {NumberValueAccessor} from './directives/number_value_accessor'; import {RadioControlValueAccessor} from './directives/radio_control_value_accessor'; +import {FormControlDirective} from './directives/reactive_directives/form_control_directive'; +import {FormGroupDirective} from './directives/reactive_directives/form_group_directive'; import {NgSelectOption, SelectControlValueAccessor} from './directives/select_control_value_accessor'; import {NgSelectMultipleOption, SelectMultipleControlValueAccessor} from './directives/select_multiple_control_value_accessor'; import {MaxLengthValidator, MinLengthValidator, PatternValidator, RequiredValidator} from './directives/validators'; @@ -18,16 +18,16 @@ import {MaxLengthValidator, MinLengthValidator, PatternValidator, RequiredValida export {CheckboxControlValueAccessor} from './directives/checkbox_value_accessor'; export {ControlValueAccessor} from './directives/control_value_accessor'; export {DefaultValueAccessor} from './directives/default_value_accessor'; -export {FormControlDirective} from './directives/form_control_directive'; export {NgControl} from './directives/ng_control'; export {NgControlGroup} from './directives/ng_control_group'; export {NgControlName} from './directives/ng_control_name'; export {NgControlStatus} from './directives/ng_control_status'; export {NgForm} from './directives/ng_form'; -export {NgFormModel} from './directives/ng_form_model'; export {NgModel} from './directives/ng_model'; export {NumberValueAccessor} from './directives/number_value_accessor'; export {RadioButtonState, RadioControlValueAccessor} from './directives/radio_control_value_accessor'; +export {FormControlDirective} from './directives/reactive_directives/form_control_directive'; +export {FormGroupDirective} from './directives/reactive_directives/form_group_directive'; export {NgSelectOption, SelectControlValueAccessor} from './directives/select_control_value_accessor'; export {NgSelectMultipleOption, SelectMultipleControlValueAccessor} from './directives/select_multiple_control_value_accessor'; export {MaxLengthValidator, MinLengthValidator, PatternValidator, RequiredValidator} from './directives/validators'; @@ -54,7 +54,7 @@ export {MaxLengthValidator, MinLengthValidator, PatternValidator, RequiredValida export const FORM_DIRECTIVES: Type[] = /*@ts2dart_const*/[ NgControlName, NgControlGroup, - NgModel, NgFormModel, NgForm, + NgModel, NgForm, NgSelectOption, NgSelectMultipleOption, DefaultValueAccessor, NumberValueAccessor, CheckboxControlValueAccessor, SelectControlValueAccessor, SelectMultipleControlValueAccessor, @@ -62,3 +62,6 @@ export const FORM_DIRECTIVES: Type[] = /*@ts2dart_const*/[ RequiredValidator, MinLengthValidator, MaxLengthValidator, PatternValidator ]; + +export const REACTIVE_FORM_DIRECTIVES: Type[] = + /*@ts2dart_const*/[FormControlDirective, FormGroupDirective]; \ No newline at end of file diff --git a/modules/@angular/common/src/forms/directives/form_interface.ts b/modules/@angular/common/src/forms/directives/form_interface.ts index 4d1b481540..511c0a4af9 100644 --- a/modules/@angular/common/src/forms/directives/form_interface.ts +++ b/modules/@angular/common/src/forms/directives/form_interface.ts @@ -5,7 +5,7 @@ import {NgControlGroup} from './ng_control_group'; /** - * An interface that {@link NgFormModel} and {@link NgForm} implement. + * An interface that {@link FormGroupDirective} and {@link NgForm} implement. * * Only used by the forms module. * @@ -23,7 +23,7 @@ export interface Form { removeControl(dir: NgControl): void; /** - * Look up the {@link Control} associated with a particular {@link NgControl}. + * Look up the {@link FormControl} associated with a particular {@link NgControl}. */ getControl(dir: NgControl): FormControl; diff --git a/modules/@angular/common/src/forms/directives/ng_control_group.ts b/modules/@angular/common/src/forms/directives/ng_control_group.ts index 9149f1b213..fc6fd81abe 100644 --- a/modules/@angular/common/src/forms/directives/ng_control_group.ts +++ b/modules/@angular/common/src/forms/directives/ng_control_group.ts @@ -17,9 +17,7 @@ export const controlGroupProvider: any = /** * Creates and binds a control group to a DOM element. * - * This directive can only be used as a child of {@link NgForm} or {@link NgFormModel}. - * - * ### Example ([live demo](http://plnkr.co/edit/7EJ11uGeaggViYM6T5nq?p=preview)) + * This directive can only be used as a child of {@link NgForm} or {@link FormGroupDirective}. * * ```typescript * @Component({ diff --git a/modules/@angular/common/src/forms/directives/ng_control_name.ts b/modules/@angular/common/src/forms/directives/ng_control_name.ts index 9d7014f6df..257fc4580b 100644 --- a/modules/@angular/common/src/forms/directives/ng_control_name.ts +++ b/modules/@angular/common/src/forms/directives/ng_control_name.ts @@ -18,9 +18,9 @@ export const controlNameBinding: any = }; /** - * Creates and binds a control with a specified name to a DOM element. + * Creates and binds a form control with a specified name to a DOM element. * - * This directive can only be used as a child of {@link NgForm} or {@link NgFormModel}. + * This directive can only be used as a child of {@link NgForm} or {@link FormGroupDirective}. * ### Example * diff --git a/modules/@angular/common/src/forms/directives/ng_form.ts b/modules/@angular/common/src/forms/directives/ng_form.ts index d488e45e6d..7fdfcea692 100644 --- a/modules/@angular/common/src/forms/directives/ng_form.ts +++ b/modules/@angular/common/src/forms/directives/ng_form.ts @@ -77,7 +77,7 @@ export const formDirectiveProvider: any = * @experimental */ @Directive({ - selector: 'form:not([ngNoForm]):not([ngFormModel]),ngForm,[ngForm]', + selector: 'form:not([ngNoForm]):not([formGroup]),ngForm,[ngForm]', providers: [formDirectiveProvider], host: { '(submit)': 'onSubmit()', diff --git a/modules/@angular/common/src/forms/directives/form_control_directive.ts b/modules/@angular/common/src/forms/directives/reactive_directives/form_control_directive.ts similarity index 88% rename from modules/@angular/common/src/forms/directives/form_control_directive.ts rename to modules/@angular/common/src/forms/directives/reactive_directives/form_control_directive.ts index ee8ca6b634..0802c036dd 100644 --- a/modules/@angular/common/src/forms/directives/form_control_directive.ts +++ b/modules/@angular/common/src/forms/directives/reactive_directives/form_control_directive.ts @@ -1,14 +1,14 @@ import {Directive, Inject, Input, OnChanges, Optional, Output, Self, SimpleChanges, forwardRef} from '@angular/core'; -import {EventEmitter, ObservableWrapper} from '../../facade/async'; -import {StringMapWrapper} from '../../facade/collection'; -import {FormControl} from '../model'; -import {NG_ASYNC_VALIDATORS, NG_VALIDATORS} from '../validators'; +import {EventEmitter, ObservableWrapper} from '../../../facade/async'; +import {StringMapWrapper} from '../../../facade/collection'; +import {FormControl} from '../../model'; +import {NG_ASYNC_VALIDATORS, NG_VALIDATORS} from '../../validators'; -import {ControlValueAccessor, NG_VALUE_ACCESSOR} from './control_value_accessor'; -import {NgControl} from './ng_control'; -import {composeAsyncValidators, composeValidators, isPropertyUpdated, selectValueAccessor, setUpControl} from './shared'; -import {AsyncValidatorFn, ValidatorFn} from './validators'; +import {ControlValueAccessor, NG_VALUE_ACCESSOR} from '../control_value_accessor'; +import {NgControl} from '../ng_control'; +import {composeAsyncValidators, composeValidators, isPropertyUpdated, selectValueAccessor, setUpControl} from '../shared'; +import {AsyncValidatorFn, ValidatorFn} from '../validators'; export const formControlBinding: any = /*@ts2dart_const*/ /* @ts2dart_Provider */ { diff --git a/modules/@angular/common/src/forms/directives/ng_form_model.ts b/modules/@angular/common/src/forms/directives/reactive_directives/form_group_directive.ts similarity index 78% rename from modules/@angular/common/src/forms/directives/ng_form_model.ts rename to modules/@angular/common/src/forms/directives/reactive_directives/form_group_directive.ts index 0f97dacd7f..199404495e 100644 --- a/modules/@angular/common/src/forms/directives/ng_form_model.ts +++ b/modules/@angular/common/src/forms/directives/reactive_directives/form_group_directive.ts @@ -1,26 +1,26 @@ -import {Directive, Inject, OnChanges, Optional, Self, SimpleChanges, forwardRef} from '@angular/core'; +import {Directive, Inject, Input, OnChanges, Optional, Output, Self, SimpleChanges, forwardRef} from '@angular/core'; -import {EventEmitter, ObservableWrapper} from '../../facade/async'; -import {ListWrapper, StringMapWrapper} from '../../facade/collection'; -import {BaseException} from '../../facade/exceptions'; -import {isBlank} from '../../facade/lang'; -import {FormControl, FormGroup} from '../model'; -import {NG_ASYNC_VALIDATORS, NG_VALIDATORS, Validators} from '../validators'; +import {EventEmitter, ObservableWrapper} from '../../../facade/async'; +import {ListWrapper, StringMapWrapper} from '../../../facade/collection'; +import {BaseException} from '../../../facade/exceptions'; +import {isBlank} from '../../../facade/lang'; +import {FormControl, FormGroup} from '../../model'; +import {NG_ASYNC_VALIDATORS, NG_VALIDATORS, Validators} from '../../validators'; -import {ControlContainer} from './control_container'; -import {Form} from './form_interface'; -import {NgControl} from './ng_control'; -import {NgControlGroup} from './ng_control_group'; -import {composeAsyncValidators, composeValidators, setUpControl, setUpFormGroup} from './shared'; +import {ControlContainer} from '../control_container'; +import {Form} from '../form_interface'; +import {NgControl} from '../ng_control'; +import {NgControlGroup} from '../ng_control_group'; +import {composeAsyncValidators, composeValidators, setUpControl, setUpFormGroup} from '../shared'; export const formDirectiveProvider: any = /*@ts2dart_const*/ /* @ts2dart_Provider */ { provide: ControlContainer, - useExisting: forwardRef(() => NgFormModel) + useExisting: forwardRef(() => FormGroupDirective) }; /** - * Binds an existing control group to a DOM element. + * Binds an existing form group to a DOM element. * * ### Example ([live demo](http://plnkr.co/edit/jqrVirudY8anJxTMUjTP?p=preview)) * @@ -32,8 +32,8 @@ export const formDirectiveProvider: any = * selector: 'my-app', * template: ` *