From ba1e64b107814c6d00bc80d6e74373f864412c14 Mon Sep 17 00:00:00 2001 From: Matt Huntington Date: Tue, 20 Jun 2017 17:45:12 -0400 Subject: [PATCH] formatting --- starwars/src/app/search/search.component.ts | 26 ++++++++++----------- use_an_api.md | 4 ++++ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/starwars/src/app/search/search.component.ts b/starwars/src/app/search/search.component.ts index 21a839a..24ea12b 100644 --- a/starwars/src/app/search/search.component.ts +++ b/starwars/src/app/search/search.component.ts @@ -3,23 +3,23 @@ import { Http } from '@angular/http'; import 'rxjs/add/operator/toPromise'; @Component({ - selector: 'app-search', - templateUrl: './search.component.html', - styleUrls: ['./search.component.css'] + selector: 'app-search', + templateUrl: './search.component.html', + styleUrls: ['./search.component.css'] }) export class SearchComponent implements OnInit { - constructor( - private http: Http - ) { } + constructor( + private http: Http + ) { } - findCharacter(name){ - this.http.get('http://swapi.co/api/people/?search=' + name) - .toPromise() - .then(response => console.log(response.json())); - } + findCharacter(name){ + this.http.get('http://swapi.co/api/people/?search=' + name) + .toPromise() + .then(response => console.log(response.json())); + } - ngOnInit() { - } + ngOnInit() { + } } diff --git a/use_an_api.md b/use_an_api.md index d94065b..d14cabc 100644 --- a/use_an_api.md +++ b/use_an_api.md @@ -11,6 +11,8 @@ 1. Set a component property to the value of an input 1. Invoke a function when the user clicks a button 1. Add the ability to make AJAX requests +1. Make an AJAX request +1. Display AJAX results in app ## Create a new app @@ -172,3 +174,5 @@ findCharacter(name){ The `rxjs/add/operator/toPromise` import that we previously wrote adds the ability to change the `Observable` (more on this in another lecture) into a `Promise` You can test this by looking in the console + +## Display AJAX results in app