I want to fetch data from Firebase using polymerfire and somehow it doesn't work.
Firebase data
lol-project (a name with 5 randomized letters)
+- events
+- (some random event id, which is auto-generated)
+- name: "haha"
+- desc: "hihi"
+- (some random event id, which is auto-generated)
+- name: "huhu"
+- desc: "hehe"
Code (Polymer v1.6, Polymerfire v0.10.2)
<link rel="import" href="../../../bower_components/polymerfire/polymerfire.html">
<link rel="import" href="../../../bower_components/polymerfire/firebase-auth.html">
<link rel="import" href="../../../bower_components/polymerfire/firebase-query.html">
...
<firebase-auth user="{{user}}"></firebase-auth>
<firebase-query id="eventquery" path="/events" data="{{events}}"></firebase-query>
<div class="Page-container" id="section1">
<template is="dom-repeat" items="[[events]]" as="item">
<p>[[item.name]]</p>
</template>
</div>
...
properties: {
events: {
type: Object,
observer: '_eventsChanged'
}
},
_eventsChanged: function(newData, oldData) {
console.log("it changed?!");
console.info(newData);
}
Firebase rules
{
"rules": {
".read": "auth != null",
".write": "auth != null"
}
}
No error, no data. The console.info(newData);
gives empty array. After hours of googling, I stumbled upon similar case, which apparently left unanswered in here (yes, this problem is pretty much similar to that one).
Anyone knows what I'm missing? Please help.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…