2016-06-23 09:47:54 -07:00
|
|
|
/**
|
|
|
|
|
* @license
|
|
|
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
|
*/
|
|
|
|
|
|
2016-07-11 13:23:38 -07:00
|
|
|
import {AppModule, PLATFORM_DIRECTIVES, Type} from '@angular/core';
|
|
|
|
|
|
2016-07-07 11:32:51 -07:00
|
|
|
import {FORM_DIRECTIVES, REACTIVE_FORM_DIRECTIVES} from './directives';
|
|
|
|
|
import {RadioControlRegistry} from './directives/radio_control_value_accessor';
|
|
|
|
|
import {FormBuilder} from './form_builder';
|
2016-06-14 18:23:40 -07:00
|
|
|
|
|
|
|
|
|
2016-07-11 13:23:38 -07:00
|
|
|
|
2016-06-27 12:27:23 -07:00
|
|
|
/**
|
2016-06-14 18:23:40 -07:00
|
|
|
* Shorthand set of providers used for building Angular forms.
|
|
|
|
|
* @experimental
|
|
|
|
|
*/
|
2016-07-07 11:32:51 -07:00
|
|
|
export const FORM_PROVIDERS: Type[] = /*@ts2dart_const*/[RadioControlRegistry];
|
2016-06-14 18:23:40 -07:00
|
|
|
|
2016-07-07 11:32:51 -07:00
|
|
|
/**
|
|
|
|
|
* Shorthand set of providers used for building reactive Angular forms.
|
|
|
|
|
* @experimental
|
|
|
|
|
*/
|
|
|
|
|
export const REACTIVE_FORM_PROVIDERS: Type[] =
|
|
|
|
|
/*@ts2dart_const*/[FormBuilder, RadioControlRegistry];
|
2016-06-27 12:27:23 -07:00
|
|
|
|
|
|
|
|
/**
|
2016-07-07 11:32:51 -07:00
|
|
|
* The app module for forms.
|
2016-06-27 12:27:23 -07:00
|
|
|
* @experimental
|
|
|
|
|
*/
|
2016-07-07 11:32:51 -07:00
|
|
|
@AppModule({providers: [FORM_PROVIDERS], directives: FORM_DIRECTIVES, pipes: []})
|
|
|
|
|
export class FormsModule {
|
2016-06-14 18:23:40 -07:00
|
|
|
}
|
|
|
|
|
|
2016-06-27 12:27:23 -07:00
|
|
|
/**
|
2016-07-07 11:32:51 -07:00
|
|
|
* The app module for reactive forms.
|
2016-06-27 12:27:23 -07:00
|
|
|
* @experimental
|
|
|
|
|
*/
|
2016-07-07 11:32:51 -07:00
|
|
|
@AppModule({providers: [REACTIVE_FORM_PROVIDERS], directives: REACTIVE_FORM_DIRECTIVES, pipes: []})
|
|
|
|
|
export class ReactiveFormsModule {
|
2016-07-11 13:23:38 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @deprecated
|
|
|
|
|
*/
|
|
|
|
|
export function disableDeprecatedForms(): any[] {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @deprecated
|
|
|
|
|
*/
|
|
|
|
|
export function provideForms(): any[] {
|
|
|
|
|
return [
|
|
|
|
|
{provide: PLATFORM_DIRECTIVES, useValue: FORM_DIRECTIVES, multi: true}, REACTIVE_FORM_PROVIDERS
|
|
|
|
|
];
|
2016-07-07 11:32:51 -07:00
|
|
|
}
|