From 501b83441de5879329e68a961d3d288e8d9e65b5 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Tue, 23 Aug 2016 21:36:34 -0700 Subject: [PATCH] refactor(forms): remove FORM_PROVIDERS, FORM_DIRECTIVES, REACTIVE_FORM_PROVIDERS, REACTIVE_DIRECTIVES All of these have been replaced by FormsModule and ReactiveFormsModule. --- .../compiler-cli/integrationtest/src/basic.ts | 2 -- .../forms/src/directives/form_interface.ts | 2 +- modules/@angular/forms/src/form_providers.ts | 19 +++---------------- modules/@angular/forms/src/forms.ts | 1 - tools/public_api_guard/forms/index.d.ts | 14 +------------- 5 files changed, 5 insertions(+), 33 deletions(-) diff --git a/modules/@angular/compiler-cli/integrationtest/src/basic.ts b/modules/@angular/compiler-cli/integrationtest/src/basic.ts index c34c5a5fd5..02048676dd 100644 --- a/modules/@angular/compiler-cli/integrationtest/src/basic.ts +++ b/modules/@angular/compiler-cli/integrationtest/src/basic.ts @@ -8,9 +8,7 @@ import {NgFor, NgIf} from '@angular/common'; import {Component, Inject, LOCALE_ID, TRANSLATIONS_FORMAT} from '@angular/core'; -import {FORM_DIRECTIVES} from '@angular/forms'; -import {MultipleComponentsMyComp} from './a/multiple_components'; @Component({ selector: 'basic', diff --git a/modules/@angular/forms/src/directives/form_interface.ts b/modules/@angular/forms/src/directives/form_interface.ts index 662120a488..c425bfb951 100644 --- a/modules/@angular/forms/src/directives/form_interface.ts +++ b/modules/@angular/forms/src/directives/form_interface.ts @@ -18,7 +18,7 @@ import {NgControl} from './ng_control'; * * Only used by the forms module. * - * @experimental + * @stable */ export interface Form { /** diff --git a/modules/@angular/forms/src/form_providers.ts b/modules/@angular/forms/src/form_providers.ts index 9c63c569d7..a7dd83bdf8 100644 --- a/modules/@angular/forms/src/form_providers.ts +++ b/modules/@angular/forms/src/form_providers.ts @@ -6,33 +6,20 @@ * 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 {RadioControlRegistry} from './directives/radio_control_value_accessor'; import {FormBuilder} from './form_builder'; - -/** - * Shorthand set of providers used for building Angular forms. - * @stable - */ -export const FORM_PROVIDERS: Type[] = [RadioControlRegistry]; - -/** - * Shorthand set of providers used for building reactive Angular forms. - * @stable - */ -export const REACTIVE_FORM_PROVIDERS: Type[] = [FormBuilder, RadioControlRegistry]; - /** * The ng module for forms. * @stable */ @NgModule({ declarations: TEMPLATE_DRIVEN_DIRECTIVES, - providers: [FORM_PROVIDERS], + providers: [RadioControlRegistry], exports: [InternalFormsSharedModule, TEMPLATE_DRIVEN_DIRECTIVES] }) export class FormsModule { @@ -44,7 +31,7 @@ export class FormsModule { */ @NgModule({ declarations: [REACTIVE_DRIVEN_DIRECTIVES], - providers: [REACTIVE_FORM_PROVIDERS], + providers: [FormBuilder, RadioControlRegistry], exports: [InternalFormsSharedModule, REACTIVE_DRIVEN_DIRECTIVES] }) export class ReactiveFormsModule { diff --git a/modules/@angular/forms/src/forms.ts b/modules/@angular/forms/src/forms.ts index 0e45c621a6..580ca1971b 100644 --- a/modules/@angular/forms/src/forms.ts +++ b/modules/@angular/forms/src/forms.ts @@ -21,7 +21,6 @@ */ -export {FORM_DIRECTIVES, REACTIVE_FORM_DIRECTIVES} from './directives'; export {AbstractControlDirective} from './directives/abstract_control_directive'; export {AbstractFormGroupDirective} from './directives/abstract_form_group_directive'; export {CheckboxControlValueAccessor} from './directives/checkbox_value_accessor'; diff --git a/tools/public_api_guard/forms/index.d.ts b/tools/public_api_guard/forms/index.d.ts index c1e2db6cde..cda5952865 100644 --- a/tools/public_api_guard/forms/index.d.ts +++ b/tools/public_api_guard/forms/index.d.ts @@ -140,7 +140,7 @@ export declare class DefaultValueAccessor implements ControlValueAccessor { writeValue(value: any): void; } -/** @experimental */ +/** @stable */ export interface Form { addControl(dir: NgControl): void; addFormGroup(dir: AbstractFormGroupDirective): void; @@ -151,12 +151,6 @@ export interface Form { updateModel(dir: NgControl, value: any): void; } -/** @stable */ -export declare const FORM_DIRECTIVES: Type[][]; - -/** @stable */ -export declare const FORM_PROVIDERS: Type[]; - /** @stable */ export declare class FormArray extends AbstractControl { controls: AbstractControl[]; @@ -437,12 +431,6 @@ export declare class PatternValidator implements Validator { }; } -/** @stable */ -export declare const REACTIVE_FORM_DIRECTIVES: Type[][]; - -/** @stable */ -export declare const REACTIVE_FORM_PROVIDERS: Type[]; - /** @stable */ export declare class ReactiveFormsModule { }