2017-06-19 7 views
-2

の使用アレイは、私は私がそれを取得するオブジェクトの配列があります。角度オブジェクト

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> 

私は1つだけ持っている場合私の配列内のオブジェクトは動作しますが、多くはありません。 私は各オブジェクトを分けるためにforeachを使う必要があると思うが、私はtyperscript構文に慣れていない。

ありがとうございました!文字列中の

Here is my console.log

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}] 
+1

に入れます? – Sajeetharan

+0

それは私の配列です、私は名前を変更するのを忘れました – TuxxyDOS

+0

'ngFor' **は' foreach' **です。複数のオブジェクトで動作しない場合は、ここに表示されている構造体にMyArrayがありません.... – Claies

答えて

0

[OK]を私は答えた:

this.serviceOne.getRemoteData().subscribe(
      data => this.MyArray = data 
     ); 

を、私はthis.History何であるか、コンストラクタ

関連する問題