refactor(forms): remove FORM_PROVIDERS, FORM_DIRECTIVES, REACTIVE_FORM_PROVIDERS, REACTIVE_DIRECTIVES

All of these have been replaced by FormsModule and ReactiveFormsModule.
This commit is contained in:
Igor Minar 2016-08-23 21:36:34 -07:00 committed by Victor Berchet
parent c03e25a7b7
commit 501b83441d
5 changed files with 5 additions and 33 deletions

View File

@ -8,9 +8,7 @@
import {NgFor, NgIf} from '@angular/common'; import {NgFor, NgIf} from '@angular/common';
import {Component, Inject, LOCALE_ID, TRANSLATIONS_FORMAT} from '@angular/core'; import {Component, Inject, LOCALE_ID, TRANSLATIONS_FORMAT} from '@angular/core';
import {FORM_DIRECTIVES} from '@angular/forms';
import {MultipleComponentsMyComp} from './a/multiple_components';
@Component({ @Component({
selector: 'basic', selector: 'basic',

View File

@ -18,7 +18,7 @@ import {NgControl} from './ng_control';
* *
* Only used by the forms module. * Only used by the forms module.
* *
* @experimental * @stable
*/ */
export interface Form { export interface Form {
/** /**

View File

@ -6,33 +6,20 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
import {NgModule, Type} from '@angular/core'; import {NgModule} from '@angular/core';
import {InternalFormsSharedModule, REACTIVE_DRIVEN_DIRECTIVES, TEMPLATE_DRIVEN_DIRECTIVES} from './directives'; import {InternalFormsSharedModule, REACTIVE_DRIVEN_DIRECTIVES, TEMPLATE_DRIVEN_DIRECTIVES} from './directives';
import {RadioControlRegistry} from './directives/radio_control_value_accessor'; import {RadioControlRegistry} from './directives/radio_control_value_accessor';
import {FormBuilder} from './form_builder'; import {FormBuilder} from './form_builder';
/**
* Shorthand set of providers used for building Angular forms.
* @stable
*/
export const FORM_PROVIDERS: Type<any>[] = [RadioControlRegistry];
/**
* Shorthand set of providers used for building reactive Angular forms.
* @stable
*/
export const REACTIVE_FORM_PROVIDERS: Type<any>[] = [FormBuilder, RadioControlRegistry];
/** /**
* The ng module for forms. * The ng module for forms.
* @stable * @stable
*/ */
@NgModule({ @NgModule({
declarations: TEMPLATE_DRIVEN_DIRECTIVES, declarations: TEMPLATE_DRIVEN_DIRECTIVES,
providers: [FORM_PROVIDERS], providers: [RadioControlRegistry],
exports: [InternalFormsSharedModule, TEMPLATE_DRIVEN_DIRECTIVES] exports: [InternalFormsSharedModule, TEMPLATE_DRIVEN_DIRECTIVES]
}) })
export class FormsModule { export class FormsModule {
@ -44,7 +31,7 @@ export class FormsModule {
*/ */
@NgModule({ @NgModule({
declarations: [REACTIVE_DRIVEN_DIRECTIVES], declarations: [REACTIVE_DRIVEN_DIRECTIVES],
providers: [REACTIVE_FORM_PROVIDERS], providers: [FormBuilder, RadioControlRegistry],
exports: [InternalFormsSharedModule, REACTIVE_DRIVEN_DIRECTIVES] exports: [InternalFormsSharedModule, REACTIVE_DRIVEN_DIRECTIVES]
}) })
export class ReactiveFormsModule { export class ReactiveFormsModule {

View File

@ -21,7 +21,6 @@
*/ */
export {FORM_DIRECTIVES, REACTIVE_FORM_DIRECTIVES} from './directives';
export {AbstractControlDirective} from './directives/abstract_control_directive'; export {AbstractControlDirective} from './directives/abstract_control_directive';
export {AbstractFormGroupDirective} from './directives/abstract_form_group_directive'; export {AbstractFormGroupDirective} from './directives/abstract_form_group_directive';
export {CheckboxControlValueAccessor} from './directives/checkbox_value_accessor'; export {CheckboxControlValueAccessor} from './directives/checkbox_value_accessor';

View File

@ -140,7 +140,7 @@ export declare class DefaultValueAccessor implements ControlValueAccessor {
writeValue(value: any): void; writeValue(value: any): void;
} }
/** @experimental */ /** @stable */
export interface Form { export interface Form {
addControl(dir: NgControl): void; addControl(dir: NgControl): void;
addFormGroup(dir: AbstractFormGroupDirective): void; addFormGroup(dir: AbstractFormGroupDirective): void;
@ -151,12 +151,6 @@ export interface Form {
updateModel(dir: NgControl, value: any): void; updateModel(dir: NgControl, value: any): void;
} }
/** @stable */
export declare const FORM_DIRECTIVES: Type<any>[][];
/** @stable */
export declare const FORM_PROVIDERS: Type<any>[];
/** @stable */ /** @stable */
export declare class FormArray extends AbstractControl { export declare class FormArray extends AbstractControl {
controls: AbstractControl[]; controls: AbstractControl[];
@ -437,12 +431,6 @@ export declare class PatternValidator implements Validator {
}; };
} }
/** @stable */
export declare const REACTIVE_FORM_DIRECTIVES: Type<any>[][];
/** @stable */
export declare const REACTIVE_FORM_PROVIDERS: Type<any>[];
/** @stable */ /** @stable */
export declare class ReactiveFormsModule { export declare class ReactiveFormsModule {
} }