Skip to main content
1 de 2

Exibir api com Ionic

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 nao 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);

});

} }

Template:

Home
<ion-item  *ngFor="let c of cotacao">
  Data : {{c.date}} Valor Compra {{c.buy}} Valor Venda {{c.sell}}    
</ion-item>          
  

Aparece o erro : Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays.