I am trying to retrieve data from firebase in my service class using:
return this.http.get('https://myfirstfirebaseproject-6da6c.firebaseio.com/products.json')
.map(res => res.json());
In home.ts, I then subscribe to it using:
this.productService.fetchProducts()
.subscribe(data => {
console.log(data)
this.products = data;
});
I output to home.html using:
<ion-card ion-item *ngFor="let product of products; let i = index" (click)="onItemClick(product)">
<ion-card-header>
{{ product.date | date }}
</ion-card-header>
<ion-card-content>
<ion-card-title>
{{ product.title }}
</ion-card-title>
<p>
{{ product.content }}
</p>
</ion-card-content>
</ion-card>
but i keep getting the error
Error: Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays.
I tried looking at similar issues but to no avail. Please help.