Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70440

Displaying an array in html

$
0
0

@NthabyMogoboya wrote:

I get this error when i try to display in my html file.
Error: Error trying to diff ‘[object Object]’. Only arrays and iterables are allowed

service.ts

private _addProduct = “http://localhost:4000/viewMenu”;
getItems(){
return this.httpClient.get(this._addProduct);
}

page.ts

menuList = ;
ngOnInit() {
this.cartService.getItems().subscribe(data => {
console.log(data);
this.menuList = data;
console.log(this.menuList);
});

page.html

<ion-card *ngFor=“let p of menuList”>
{{p.item_name}}

{{p.item_price | currency:‘R’}}

Posts: 5

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 70440

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>