[英]dom-repeat Firebase data in Polymer
I have a template that returns an amount from a Firebase realtime database, and it is correctly mapped, and returns a value when the path="/orders"
. 我有一个模板,它从Firebase实时数据库返回一个数量,并且它被正确映射,并在
path="/orders"
时返回一个值。 However, when I change the path to path="/orderHistory/[[user.uid]]"
with the same data structure stored at the location, nothing is returned. 但是,当我使用存储在该位置的相同数据结构更改
path="/orderHistory/[[user.uid]]"
的路径时,不会返回任何内容。
The user
auth object is properly populated, as I have other elements that are returning data properly using this pattern. 正确填充了
user
auth对象,因为我有其他使用此模式正确返回数据的元素。
<firebase-auth user="{{user}}"></firebase-auth>
<firebase-document path="/orders" data="{{orders}}"></firebase-document>
<template is="dom-repeat" items="{{_toArray(orders)}}">
<p3>{{item.amount}}</p3>
</template>
... ...
_toArray: function (orders) {
return Object.keys(orders).map(function (key) {
return {
date: Date(key),
amount1: orders[key]['Item']['Amount']
};
});
}
... ...
I am trying to store and return order data... and the JSON structure is as follows: 我正在尝试存储和返回订单数据......而JSON结构如下:
{
"1473829170599" : {
"0" : {
"Item" : {
"Amount" : 16,
"QR" : "Bw16Bb14Ni17",
"Quantity" : 2
}
},
"hasFabbed" : 0,
"hasPaid" : 0,
"hasShipped" : 0
}
How can I return cart data for a user with Polymer's dom-repeat
pattern? 如何使用Polymer的
dom-repeat
模式为用户返回购物车数据?
使用<firebase-query>
而不是<firebase-document>
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.