-2
我有,我得到與對象的數組:角 - 對象可以使用Array
this.serviceOne.getRemoteData().subscribe(
data => this.MyArray.push(data)
);
但是我不能使用它:
<ion-card *ngFor="let ma of MyArray; let i=index">
<p>{{ma.stuff}}</p>
</ion-card>
當我只有一個在我的數組中的對象,它的工作,但沒有太多。 我想我必須使用foreach來分離每個對象,但我不熟悉typerscript語法。
感謝您的幫助!
CONSOLE.LOG字符串:
[{
"id_oiseau":1,
"nom_commun":"Hirondelle",
"lieu_signalement":"Foret",
"date_signalement":"2017-05-16",
"condition_signalement":"Aile coincee sous branche",
"date_reception":"2017-05-16",
"date_renvoi":"2017-05-02",
"descriptif_etat":"Aile cassee",
"immatriculation":"EZ654ERRZ",
"etat_actuel":"En attente de livraison",
"image":"bird-profil.jpg",
"id_oiseau_dico":1,
"id_adherent_lpo":1,
"id_acteur":1,
"pays":"France",
"nom_codifie":"HIRON-NANT-4949845",
"id_statut_oiseau":1,
"id_local_lpo":1},
{"id_oiseau":2,"nom_commun":"Moineau","lieu_signalement":"Sur la route","date_signalement":"2017-05-12","condition_signalement":"Sur le bas cote avec trace de sang","date_reception":"2017-05-03","date_renvoi":"2017-05-19","descriptif_etat":"Ne bouge plus sauf la tete","immatriculation":null,"etat_actuel":"Convalescence","image":"bird-1.jpg","id_oiseau_dico":2,"id_adherent_lpo":2,"id_acteur":2,"pays":"France","nom_codifie":"MOIN-ANG-4254545","id_statut_oiseau":2,"id_local_lpo":2}]
是什麼this.History ? – Sajeetharan
這是我的陣列,我忘了更改名稱 – TuxxyDOS
'ngFor' **是一個'foreach' **。如果它「僅適用於一個對象」,但不適用於倍數,則「MyArray」不在您在此處顯示的結構中...... – Claies