1
我在Polymer應用程序中登錄了firebase,然後從用戶目錄獲取數據並將其作爲數據存儲。在數據我有serveral的子目錄(「書」,「聯繫人」等),書籍和接觸我有serveral的項目/對象(serveral的書籍/聯繫人):Firebase-Polymer:從數據變量訪問子對象/數組
{
"users" : {
"google:117487344423952031114" : {
"books" : {
"kjsdkk" : {
"author" : "Edward",
"id" : 11,
"language" : "English",
"original" : "Shakeout"
},
sdlsjdksjhdkjh" : {
"author" : "Olaf",
"id" : 11,
"language" : "Deutsch",
"original" : "BlaBlaBla"
},
"x,kshdkjha" : {
"author" : "Don",
"id" : 10,
"language" : "Latin",
"original" : "Carpe diem"
}
},
"contacts" : {
"sadjköljds" : {
"email" : "[email protected]",
"name" : "Bob",
"phone" : "+01 34566646467456"
},
"xölmödlkdcls" : {
"address" : "First Street, 2",
"name" : "Robert",
"phone" : "+49 646415664"
}
}
}
}
在我的Web應用程序我有2個部分(書籍和聯繫人),我要循環使用某種形式的這一切書籍/聯繫人:
<template is="dom-repeat" items="{{data.books}} as="book">
<tr on-tap="_openBookDialog">
<td>{{book.id}}</td>
<td>{{book.author}}</td>
<td>{{book.original}}</td>
<td>{{book.language}}</td>
<td>{{book.status}}</td>
</tr>
</template>
但是,當我打電話items="{{data.books}}"
我的書沒有得到我的顯示屏幕上,只有當我把我的書籍直接在數據「節點」下以獨特的ID書籍顯示,我如何從數據Array/Objects訪問書籍?
謝謝,它更好的方式你決定! –