whatever() {
this.http.get('http://www.example.com')
.map(
(response: Response) => {
const cats: Cat[] = response.json();
for (let cat of cats) {
if(!cat['kittens']) {
cat['kittens'] = [];
}
}
return cats;
}
}
.subscribe(
(cats: Cat[]) => {
this.myService.setCats(cats);
}
}
}
}
No comments:
Post a Comment