Skip to content

Commit 63c7d9c

Browse files
karajelbourn
authored andcommitted
docs: add info about bootstrapping new forms module (#810)
1 parent 4e9f746 commit 63c7d9c

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

GETTING_STARTED.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,37 @@ directives: [MD_CARD_DIRECTIVES, MD_BUTTON_DIRECTIVES]
115115
- [Puppy Love Mobile (Google IO 2016)](https://github.com/kara/puppy-love-io)
116116
- [Material 2 Sample App](https://github.com/jelbourn/material2-app)
117117

118+
### Additional steps for using Material components with forms
119+
120+
If you're using Angular Material 2 version alpha.6 or later, you'll need to upgrade to Angular 2's
121+
new forms module. Here's how:
122+
123+
- Install the `@angular/forms` package. If you're on Angular RC.4, install version 0.2.0.
124+
125+
```bash
126+
npm install @angular/forms
127+
```
128+
129+
- Change your bootstrap file to disable the old form directives and provide the new form
130+
directives.
131+
132+
**main.ts**
133+
```ts
134+
import {disableDeprecatedForms, provideForms} from '@angular/forms';
135+
136+
bootstrap(MyAppComponent, [
137+
disableDeprecatedForms(),
138+
provideForms()
139+
]);
140+
```
141+
142+
- Import any and all forms symbols - `NgForm`, `Validators`, etc - from `@angular/forms`.
143+
Importing them from `@angular/common` will result in a `No value accessor found` error.
144+
145+
- Update your form code to use the new APIs. See more information about the changes in the proposal
146+
doc [here](https://docs.google.com/document/u/1/d/1RIezQqE4aEhBRmArIAS1mRIZtWFf6JxN_7B4meyWK0Y/pub)
147+
and the official documentation [here](https://angular.io/docs/ts/latest/guide/forms.html).
148+
118149
### Additional steps for `md-icon` setup:
119150

120151
- If you want to use Material Design icons, load the Material Design font in your `index.html`. `md-icon` supports any font icons or svg icons,

0 commit comments

Comments
 (0)