From aa87754de345e5bdce057d7563b513da0cf0e33d Mon Sep 17 00:00:00 2001 From: Matt Huntington Date: Tue, 20 Jun 2017 17:18:05 -0400 Subject: [PATCH] Import Form functionality into the app --- starwars/src/app/app.module.ts | 5 ++++- use_an_api.md | 29 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/starwars/src/app/app.module.ts b/starwars/src/app/app.module.ts index 2499bdd..831cf7d 100644 --- a/starwars/src/app/app.module.ts +++ b/starwars/src/app/app.module.ts @@ -4,13 +4,16 @@ import { NgModule } from '@angular/core'; import { AppComponent } from './app.component'; import { SearchComponent } from './search/search.component'; +import { FormsModule } from '@angular/forms'; + @NgModule({ declarations: [ AppComponent, SearchComponent ], imports: [ - BrowserModule + BrowserModule, + FormsModule ], providers: [], bootstrap: [AppComponent] diff --git a/use_an_api.md b/use_an_api.md index 7e6a6bf..bab7719 100644 --- a/use_an_api.md +++ b/use_an_api.md @@ -7,6 +7,7 @@ 1. Clean up app.component.html 1. Add search component to app 1. Add Form HTML to search component +1. Import Form functionality into the app ## Create a new app @@ -50,3 +51,31 @@ Edit `src/app/search/search.component.html`: ``` + +## Import Form functionality into the app + +Edit `src/app/app.module.ts` to import `FormsModule` and place it as an import: + +```javascript +import { BrowserModule } from '@angular/platform-browser'; +import { NgModule } from '@angular/core'; + +import { AppComponent } from './app.component'; +import { SearchComponent } from './search/search.component'; + +import { FormsModule } from '@angular/forms'; //import FormsModule + +@NgModule({ + declarations: [ + AppComponent, + SearchComponent + ], + imports: [ + BrowserModule, + FormsModule //add it as an import + ], + providers: [], + bootstrap: [AppComponent] +}) +export class AppModule { } +```