クライアントのリストを表示するビューを作成しようとしていますが、Ionicのhtmlタイプとオブジェクトのために問題に遭遇しています。Ionic 2:オブジェクトリストをループする
は、ここに私のオブジェクトです:
x = { Consultation: [{name: "Joe Smith}, {name: "Jane Doe"}],
Re-evaluation: [{name: "Joe Smith2}, {name: "Jane Doe2"}],
Meeting: [{name: "Joe Smith3}, {name: "Jane Doe3"}],
Testing: [{name: "Joe Smith4}, {name: "Jane Doe4"}]
}
と私はappointment_types
としてObject.keys(x)
別名["Consultation", "Re-evaluation", "Meeting", "Testing"]
を定義します。私の見解では
:
<ion-list>
<ion-list-header *ngFor="let type of appointment_types">{{ type }}</ion-list-header>
<!-- type is no longer defined after ion-list-header closes -->
<ion-item-sliding class="shaded-slider" *ngFor="let client of appointment_types[type]">
<ion-item>{{ client.name }}</ion-item>
</ion-item-sliding>
</ion-list>
は私がappointment_types
ループ内で滞在して行うことができるものはありますか?
<ion-list *ngFor="let type of appointment_types">
を、あなたがtype
し、元のオブジェクトx
を持っているときに、あなたのような内側の配列でx
オブジェクトを反復処理することができます。
だ、あなたは 'イオンlist'に最初の' * ngFor'を置く必要があります。 – developer033
ngForでdivを追加してみてください。 like