Boa Tarde a todos, estou consumindo uma api, porém não consigo exibi-la no meu template, ela esta sendo consumida, aparece no console, porem naoporém não consigo no 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);
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();
} }
Template:
Home
}
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>
Aparece o erro : Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays.
Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays.