more data to show

master
Matt Huntington 9 years ago
parent ba47925d4b
commit ac8cef86c6

@ -6,6 +6,24 @@
<section *ngIf="results">
<h2>Search Results</h2>
<ul>
<li *ngFor="let character of results">{{character.name}}</li>
<li *ngFor="let character of results">
<h3>{{character.name}}</h3>
<dl>
<dt>Birth Year</dt>
<dd>{{character.birth_year}}</dd>
<dt>Eye Color</dt>
<dd>{{character.eye_color}}</dd>
<dt>Hair Color</dt>
<dd>{{character.hair_color}}</dd>
<dt>Gender</dt>
<dd>{{character.gender}}</dd>
<dt>Height</dt>
<dd>{{character.height}}</dd>
<dt>Mass</dt>
<dd>{{character.mass}}</dd>
<dt>Skin Color</dt>
<dd>{{character.skin_color}}</dd>
</dl>
</li>
</ul>
</section>

@ -17,7 +17,7 @@ export class SearchComponent implements OnInit {
findCharacter(name){
this.http.get('http://swapi.co/api/people/?search=' + name)
.toPromise()
.then(response => this.results = response.json().results );
.then(response => console.log(this.results = response.json().results) );
}
ngOnInit() {

Loading…
Cancel
Save