| 
									
										
										
										
											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, Type} from '@angular/core'; | 
					
						
							| 
									
										
										
										
											2016-06-08 16:38:52 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | import {CheckboxControlValueAccessor} from './directives/checkbox_value_accessor'; | 
					
						
							|  |  |  | import {DefaultValueAccessor} from './directives/default_value_accessor'; | 
					
						
							| 
									
										
										
										
											2016-08-11 09:01:09 -07:00
										 |  |  | import {NgControlStatus, NgControlStatusGroup} from './directives/ng_control_status'; | 
					
						
							| 
									
										
										
										
											2016-06-08 16:38:52 -07:00
										 |  |  | import {NgForm} from './directives/ng_form'; | 
					
						
							|  |  |  | import {NgModel} from './directives/ng_model'; | 
					
						
							| 
									
										
										
										
											2016-06-12 16:37:42 -07:00
										 |  |  | import {NgModelGroup} from './directives/ng_model_group'; | 
					
						
							| 
									
										
										
										
											2016-06-08 15:36:24 -07:00
										 |  |  | import {NumberValueAccessor} from './directives/number_value_accessor'; | 
					
						
							|  |  |  | import {RadioControlValueAccessor} from './directives/radio_control_value_accessor'; | 
					
						
							| 
									
										
										
										
											2016-10-19 20:12:13 +03:00
										 |  |  | import {RangeValueAccessor} from './directives/range_value_accessor'; | 
					
						
							| 
									
										
										
										
											2016-06-10 19:10:17 -07:00
										 |  |  | import {FormControlDirective} from './directives/reactive_directives/form_control_directive'; | 
					
						
							| 
									
										
										
										
											2016-06-12 16:37:42 -07:00
										 |  |  | import {FormControlName} from './directives/reactive_directives/form_control_name'; | 
					
						
							| 
									
										
										
										
											2016-06-10 19:10:17 -07:00
										 |  |  | import {FormGroupDirective} from './directives/reactive_directives/form_group_directive'; | 
					
						
							| 
									
										
										
										
											2016-08-02 09:40:42 -07:00
										 |  |  | import {FormArrayName, FormGroupName} from './directives/reactive_directives/form_group_name'; | 
					
						
							| 
									
										
										
										
											2016-06-08 16:38:52 -07:00
										 |  |  | 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'; | 
					
						
							| 
									
										
										
										
											2016-06-08 15:36:24 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-08 16:38:52 -07:00
										 |  |  | export {CheckboxControlValueAccessor} from './directives/checkbox_value_accessor'; | 
					
						
							|  |  |  | export {ControlValueAccessor} from './directives/control_value_accessor'; | 
					
						
							|  |  |  | export {DefaultValueAccessor} from './directives/default_value_accessor'; | 
					
						
							|  |  |  | export {NgControl} from './directives/ng_control'; | 
					
						
							| 
									
										
										
										
											2016-08-11 09:01:09 -07:00
										 |  |  | export {NgControlStatus, NgControlStatusGroup} from './directives/ng_control_status'; | 
					
						
							| 
									
										
										
										
											2016-06-08 16:38:52 -07:00
										 |  |  | export {NgForm} from './directives/ng_form'; | 
					
						
							|  |  |  | export {NgModel} from './directives/ng_model'; | 
					
						
							| 
									
										
										
										
											2016-06-12 16:37:42 -07:00
										 |  |  | export {NgModelGroup} from './directives/ng_model_group'; | 
					
						
							| 
									
										
										
										
											2016-06-08 15:36:24 -07:00
										 |  |  | export {NumberValueAccessor} from './directives/number_value_accessor'; | 
					
						
							| 
									
										
										
										
											2016-06-15 15:15:41 -07:00
										 |  |  | export {RadioControlValueAccessor} from './directives/radio_control_value_accessor'; | 
					
						
							| 
									
										
										
										
											2016-10-19 20:12:13 +03:00
										 |  |  | export {RangeValueAccessor} from './directives/range_value_accessor'; | 
					
						
							| 
									
										
										
										
											2016-06-10 19:10:17 -07:00
										 |  |  | export {FormControlDirective} from './directives/reactive_directives/form_control_directive'; | 
					
						
							| 
									
										
										
										
											2016-06-12 16:37:42 -07:00
										 |  |  | export {FormControlName} from './directives/reactive_directives/form_control_name'; | 
					
						
							| 
									
										
										
										
											2016-06-10 19:10:17 -07:00
										 |  |  | export {FormGroupDirective} from './directives/reactive_directives/form_group_directive'; | 
					
						
							| 
									
										
										
										
											2016-08-02 09:40:42 -07:00
										 |  |  | export {FormArrayName, FormGroupName} from './directives/reactive_directives/form_group_name'; | 
					
						
							| 
									
										
										
										
											2016-06-08 16:38:52 -07:00
										 |  |  | 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'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-10 18:21:28 -07:00
										 |  |  | export const SHARED_FORM_DIRECTIVES: Type<any>[] = [ | 
					
						
							| 
									
										
											  
											
												feat(forms): add modules for forms and deprecatedForms (#9859)
Closes #9732
BREAKING CHANGE:
We have removed the deprecated form directives from the built-in platform directive list, so apps are not required to package forms with their app. This also makes forms friendly to offline compilation.
Instead, we have exposed three modules:
OLD API:
- `DeprecatedFormsModule`
NEW API:
- `FormsModule`
- `ReactiveFormsModule`
If you provide one of these modules, the default forms directives and providers from that module will be available to you app-wide.  Note: You can provide both the `FormsModule` and the `ReactiveFormsModule` together if you like, but they are fully-functional separately.
**Before:**
```ts
import {disableDeprecatedForms, provideForms} from @angular/forms;
bootstrap(App, [
   disableDeprecatedForms(),
   provideForms()
]);
```
**After:**
```ts
import {DeprecatedFormsModule} from @angular/common;
bootstrap(App, {modules: [DeprecatedFormsModule] });
```
-OR-
```ts
import {FormsModule} from @angular/forms;
bootstrap(App, {modules: [FormsModule] });
```
-OR-
```ts
import {ReactiveFormsModule} from @angular/forms;
bootstrap(App, {modules: [ReactiveFormsModule] });
```
You can also choose not to provide any forms module and run your app without forms.
Or you can choose not to provide any forms module *and* provide form directives at will.  This will allow you to use the deprecatedForms API for some components and not others.
```
import {FORM_DIRECTIVES, FORM_PROVIDERS} from @angular/forms;
@Component({
   selector: some-comp,
   directives: [FORM_DIRECTIVES],
   providers: [FORM_PROVIDERS]
})
class SomeComp
```
											
										 
											2016-07-07 11:32:51 -07:00
										 |  |  |   NgSelectOption, NgSelectMultipleOption, DefaultValueAccessor, NumberValueAccessor, | 
					
						
							| 
									
										
										
										
											2016-10-19 20:12:13 +03:00
										 |  |  |   RangeValueAccessor, CheckboxControlValueAccessor, SelectControlValueAccessor, | 
					
						
							|  |  |  |   SelectMultipleControlValueAccessor, RadioControlValueAccessor, NgControlStatus, | 
					
						
							|  |  |  |   NgControlStatusGroup, RequiredValidator, MinLengthValidator, MaxLengthValidator, PatternValidator | 
					
						
							| 
									
										
											  
											
												feat(forms): add modules for forms and deprecatedForms (#9859)
Closes #9732
BREAKING CHANGE:
We have removed the deprecated form directives from the built-in platform directive list, so apps are not required to package forms with their app. This also makes forms friendly to offline compilation.
Instead, we have exposed three modules:
OLD API:
- `DeprecatedFormsModule`
NEW API:
- `FormsModule`
- `ReactiveFormsModule`
If you provide one of these modules, the default forms directives and providers from that module will be available to you app-wide.  Note: You can provide both the `FormsModule` and the `ReactiveFormsModule` together if you like, but they are fully-functional separately.
**Before:**
```ts
import {disableDeprecatedForms, provideForms} from @angular/forms;
bootstrap(App, [
   disableDeprecatedForms(),
   provideForms()
]);
```
**After:**
```ts
import {DeprecatedFormsModule} from @angular/common;
bootstrap(App, {modules: [DeprecatedFormsModule] });
```
-OR-
```ts
import {FormsModule} from @angular/forms;
bootstrap(App, {modules: [FormsModule] });
```
-OR-
```ts
import {ReactiveFormsModule} from @angular/forms;
bootstrap(App, {modules: [ReactiveFormsModule] });
```
You can also choose not to provide any forms module and run your app without forms.
Or you can choose not to provide any forms module *and* provide form directives at will.  This will allow you to use the deprecatedForms API for some components and not others.
```
import {FORM_DIRECTIVES, FORM_PROVIDERS} from @angular/forms;
@Component({
   selector: some-comp,
   directives: [FORM_DIRECTIVES],
   providers: [FORM_PROVIDERS]
})
class SomeComp
```
											
										 
											2016-07-07 11:32:51 -07:00
										 |  |  | ]; | 
					
						
							| 
									
										
										
										
											2016-06-08 15:36:24 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-10 18:21:28 -07:00
										 |  |  | export const TEMPLATE_DRIVEN_DIRECTIVES: Type<any>[] = [NgModel, NgModelGroup, NgForm]; | 
					
						
							| 
									
										
											  
											
												feat(forms): add modules for forms and deprecatedForms (#9859)
Closes #9732
BREAKING CHANGE:
We have removed the deprecated form directives from the built-in platform directive list, so apps are not required to package forms with their app. This also makes forms friendly to offline compilation.
Instead, we have exposed three modules:
OLD API:
- `DeprecatedFormsModule`
NEW API:
- `FormsModule`
- `ReactiveFormsModule`
If you provide one of these modules, the default forms directives and providers from that module will be available to you app-wide.  Note: You can provide both the `FormsModule` and the `ReactiveFormsModule` together if you like, but they are fully-functional separately.
**Before:**
```ts
import {disableDeprecatedForms, provideForms} from @angular/forms;
bootstrap(App, [
   disableDeprecatedForms(),
   provideForms()
]);
```
**After:**
```ts
import {DeprecatedFormsModule} from @angular/common;
bootstrap(App, {modules: [DeprecatedFormsModule] });
```
-OR-
```ts
import {FormsModule} from @angular/forms;
bootstrap(App, {modules: [FormsModule] });
```
-OR-
```ts
import {ReactiveFormsModule} from @angular/forms;
bootstrap(App, {modules: [ReactiveFormsModule] });
```
You can also choose not to provide any forms module and run your app without forms.
Or you can choose not to provide any forms module *and* provide form directives at will.  This will allow you to use the deprecatedForms API for some components and not others.
```
import {FORM_DIRECTIVES, FORM_PROVIDERS} from @angular/forms;
@Component({
   selector: some-comp,
   directives: [FORM_DIRECTIVES],
   providers: [FORM_PROVIDERS]
})
class SomeComp
```
											
										 
											2016-07-07 11:32:51 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-10 18:21:28 -07:00
										 |  |  | export const REACTIVE_DRIVEN_DIRECTIVES: Type<any>[] = | 
					
						
							| 
									
										
										
										
											2016-07-30 19:18:14 -07:00
										 |  |  |     [FormControlDirective, FormGroupDirective, FormControlName, FormGroupName, FormArrayName]; | 
					
						
							| 
									
										
										
										
											2016-06-10 17:28:19 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-08 15:36:24 -07:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2016-09-23 16:23:28 -07:00
										 |  |  |  * A list of all the form directives. | 
					
						
							| 
									
										
										
										
											2016-06-08 15:36:24 -07:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2016-08-17 07:44:39 -07:00
										 |  |  |  * @stable | 
					
						
							| 
									
										
										
										
											2016-06-08 15:36:24 -07:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2016-08-10 18:21:28 -07:00
										 |  |  | export const FORM_DIRECTIVES: Type<any>[][] = [TEMPLATE_DRIVEN_DIRECTIVES, SHARED_FORM_DIRECTIVES]; | 
					
						
							| 
									
										
										
										
											2016-06-10 19:10:17 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-27 12:27:23 -07:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2016-08-17 07:44:39 -07:00
										 |  |  |  * @stable | 
					
						
							| 
									
										
										
										
											2016-06-27 12:27:23 -07:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2016-08-10 18:21:28 -07:00
										 |  |  | export const REACTIVE_FORM_DIRECTIVES: Type<any>[][] = | 
					
						
							| 
									
										
										
										
											2016-07-30 19:18:14 -07:00
										 |  |  |     [REACTIVE_DRIVEN_DIRECTIVES, SHARED_FORM_DIRECTIVES]; | 
					
						
							| 
									
										
										
										
											2016-07-18 03:50:31 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Internal module used for sharing directives between FormsModule and ReactiveFormsModule | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | @NgModule({declarations: SHARED_FORM_DIRECTIVES, exports: SHARED_FORM_DIRECTIVES}) | 
					
						
							|  |  |  | export class InternalFormsSharedModule { | 
					
						
							|  |  |  | } |