From 9a5d661410c2435a6a92b2fe500f91be30596707 Mon Sep 17 00:00:00 2001 From: Matt Huntington Date: Tue, 20 Jun 2017 15:58:58 -0400 Subject: [PATCH] setting up ability to make ajax request --- src/app/app.module.ts | 2 ++ src/app/search/search.component.ts | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/app.module.ts b/src/app/app.module.ts index c1ecfb9..b9af65e 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -5,6 +5,7 @@ import { AppComponent } from './app.component'; import { SearchComponent } from './search/search.component'; import { FormsModule } from '@angular/forms'; +import { HttpModule } from '@angular/http'; @NgModule({ declarations: [ @@ -13,6 +14,7 @@ import { FormsModule } from '@angular/forms'; ], imports: [ BrowserModule, + HttpModule, FormsModule ], providers: [], diff --git a/src/app/search/search.component.ts b/src/app/search/search.component.ts index edd59fb..571af24 100644 --- a/src/app/search/search.component.ts +++ b/src/app/search/search.component.ts @@ -1,4 +1,6 @@ import { Component, OnInit } from '@angular/core'; +import { Http } from '@angular/http'; +import 'rxjs/add/operator/toPromise'; @Component({ selector: 'app-search', @@ -7,7 +9,9 @@ import { Component, OnInit } from '@angular/core'; }) export class SearchComponent implements OnInit { - constructor() { } + constructor( + private http: Http + ) { } findCharacter(name){ console.log('finding ' + name);