Good afternoon everyone, I'm consuming an api, but I can not display it in my template, it's being consumed, it appears on the console, but I can not get it in the template.
Component:
import { PaisesProvider } from './../../providers/paises/paises';
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
cotacao: string [];
constructor(public navCtrl: NavController,
private paisesProvider: PaisesProvider) {
}
ionViewDidLoad() {
this.listaCotacao();
}
listaCotacao() {
this.paisesProvider.listaPaises()
.subscribe(data => {
this.cotacao = data;
console.log(this.cotacao);
});
}
}
Template:
<ion-header>
<ion-navbar>
<ion-title>Home</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
<ion-item *ngFor="let c of cotacao">
Data : {{c.date}} Valor Compra {{c.buy}} Valor Venda {{c.sell}}
</ion-item>
</ion-content>
The error appears:
Can not find a supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays.