0
我試圖遍歷內容。我嘗試了一些在StackOverflow中找到的答案,但沒有一個適合我。循環播放對象Ionic3/Angular4
我有這樣的JSON
{
"-KmdNgomUUnfV8fkzne_":{
"name":"Abastecimento"
},
"-KmdNgzguGKbCEfyQ3F0":{
"name":"Consórcios"
},
"-KmdNh9_jtBlFqY1Y_Rj":{
"name":"Consultoria aeronáutica"
},
"-KmdNhKNCVEiJ2Ou8bUV":{
"name":"Cursos e treinamentos"
},
"-KmdNhVRoKfaCM--304M":{
"name":"Financiamento"
},
"-KmdNhfIC6fA0kDJcVBq":{
"name":"Hangaragem"
},
"-KmdNhu0X-PteQMyHp_n":{
"name":"Mecânica"
},
"-KmdNi6ZmmYXnoOTXoC5":{
"name":"Táxi Aéreo"
},
"-KmdNiHFhiX_crXB1L2R":{
"name":"Outros"
}
}
I'm使用此代碼
<button ion-item *ngFor="let cat of subcategories" (click)="onSubcategorySelect(cat)">
{{ cat.name }}
</button>
它不工作試圖循環。我究竟做錯了什麼?
看看這個 - https://stackoverflow.com/questions/41396435/how-to-iterate-object-object-using-ngfor-in-angular-2 –