From 8a1d36f7f1f88e4e840fe8d91b656c40e4bc4de5 Mon Sep 17 00:00:00 2001 From: Kara Erickson Date: Mon, 4 Jul 2016 13:05:20 -0700 Subject: [PATCH] docs(getting_started): add info about bootstrapping new forms module --- GETTING_STARTED.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/GETTING_STARTED.md b/GETTING_STARTED.md index 5e61351d9abd..58cd8c05aa3f 100644 --- a/GETTING_STARTED.md +++ b/GETTING_STARTED.md @@ -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,