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-18 03:50:31 -07:00
|
|
|
import {NgModule, PLATFORM_DIRECTIVES, Type} from '@angular/core';
|
2016-07-11 13:23:38 -07:00
|
|
|
|
2016-07-18 03:50:31 -07:00
|
|
|
import {FORM_DIRECTIVES, InternalFormsSharedModule, REACTIVE_DRIVEN_DIRECTIVES, REACTIVE_FORM_DIRECTIVES, SHARED_FORM_DIRECTIVES, TEMPLATE_DRIVEN_DIRECTIVES} from './directives';
|
2016-07-07 11:32:51 -07:00
|
|
|
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-30 19:18:14 -07:00
|
|
|
export const FORM_PROVIDERS: Type[] = [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
|
|
|
|
|
*/
|
2016-07-30 19:18:14 -07:00
|
|
|
export const REACTIVE_FORM_PROVIDERS: Type[] = [FormBuilder, RadioControlRegistry];
|
2016-06-27 12:27:23 -07:00
|
|
|
|
|
|
|
|
/**
|
2016-07-18 03:50:31 -07:00
|
|
|
* The ng module for forms.
|
2016-06-27 12:27:23 -07:00
|
|
|
* @experimental
|
|
|
|
|
*/
|
2016-07-18 03:50:31 -07:00
|
|
|
@NgModule({
|
|
|
|
|
declarations: TEMPLATE_DRIVEN_DIRECTIVES,
|
|
|
|
|
providers: [FORM_PROVIDERS],
|
|
|
|
|
exports: [InternalFormsSharedModule, TEMPLATE_DRIVEN_DIRECTIVES]
|
|
|
|
|
})
|
2016-07-07 11:32:51 -07:00
|
|
|
export class FormsModule {
|
2016-06-14 18:23:40 -07:00
|
|
|
}
|
|
|
|
|
|
2016-06-27 12:27:23 -07:00
|
|
|
/**
|
2016-07-18 03:50:31 -07:00
|
|
|
* The ng module for reactive forms.
|
2016-06-27 12:27:23 -07:00
|
|
|
* @experimental
|
|
|
|
|
*/
|
2016-07-18 03:50:31 -07:00
|
|
|
@NgModule({
|
|
|
|
|
declarations: [REACTIVE_DRIVEN_DIRECTIVES],
|
|
|
|
|
providers: [REACTIVE_FORM_PROVIDERS],
|
|
|
|
|
exports: [InternalFormsSharedModule, REACTIVE_DRIVEN_DIRECTIVES]
|
|
|
|
|
})
|
2016-07-07 11:32:51 -07:00
|
|
|
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-18 03:50:31 -07:00
|
|
|
}
|