I am trying out Angular 2's http GET to retrieve a list of top articles on HackerNews and after which I will retrieve their respective details in a nested observable.
I encounter this error when I try to loop and display the data in my HTML.
Cannot find a differ supporting object '[object Object]'
Also, I am guessing there should be a better way to do this, any pointer?
getTopPost() {
this.http.get('https://hacker-news.firebaseio.com/v0/topstories.json')
.map(res => res.json())
.subscribe(
data => {
data.map(function(postId){
let storyUrl = "https://hacker-news.firebaseio.com/v0/item/"+ postId +".json";
that.http.get(storyUrl)
.map(res => res.json())
.subscribe(data => that.hnData = data,
err => that.logError(err),
() => console.log(that.hnData));
});
},
err => this.logError(err);
);
}
HTML
<ion-item *ngFor="#item of hnData">
{{item.title}}
</ion-item>
![Cannot find a differ supporting object '[object Object]'](https://www.lemona.fr/i.sstatic.net/FqfbY.png)