docs: add info about bootstrapping new forms module (#810)

This commit is contained in:
Kara
2016-07-04 17:07:48 -07:00
committed by Jeremy Elbourn
parent 4e9f74604b
commit 63c7d9c27c
+31
View File
@@ -115,6 +115,37 @@ directives: [MD_CARD_DIRECTIVES, MD_BUTTON_DIRECTIVES]
- [Puppy Love Mobile (Google IO 2016)](https://github.com/kara/puppy-love-io)
- [Material 2 Sample App](https://github.com/jelbourn/material2-app)
### Additional steps for using Material components with forms
If you're using Angular Material 2 version alpha.6 or later, you'll need to upgrade to Angular 2's
new forms module. Here's how:
- Install the `@angular/forms` package. If you're on Angular RC.4, install version 0.2.0.
```bash
npm install @angular/forms
```
- Change your bootstrap file to disable the old form directives and provide the new form
directives.
**main.ts**
```ts
import {disableDeprecatedForms, provideForms} from '@angular/forms';
bootstrap(MyAppComponent, [
disableDeprecatedForms(),
provideForms()
]);
```
- Import any and all forms symbols - `NgForm`, `Validators`, etc - from `@angular/forms`.
Importing them from `@angular/common` will result in a `No value accessor found` error.
- Update your form code to use the new APIs. See more information about the changes in the proposal
doc [here](https://docs.google.com/document/u/1/d/1RIezQqE4aEhBRmArIAS1mRIZtWFf6JxN_7B4meyWK0Y/pub)
and the official documentation [here](https://angular.io/docs/ts/latest/guide/forms.html).
### Additional steps for `md-icon` setup:
- 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,