cleaner still

master
Matt Huntington 9 years ago
parent bf15158ea8
commit 7efd6d9dc8

@ -31,7 +31,7 @@ export class SearchComponent implements OnInit {
.debounceTime(300) .debounceTime(300)
.distinctUntilChanged() .distinctUntilChanged()
.switchMap(name => this.characterSearchService.createAPIObservable(name)).subscribe(results => { .switchMap(name => this.characterSearchService.createAPIObservable(name)).subscribe(results => {
this.results = results.json().results; this.results = results;
}); });
} }

@ -9,6 +9,7 @@ export class SearchService {
createAPIObservable(name){ createAPIObservable(name){
return this.http return this.http
.get('http://swapi.co/api/people/?search=' + name); .get('http://swapi.co/api/people/?search=' + name)
.map(results => results.json().results);
} }
} }

Loading…
Cancel
Save