0
在从PolymerLabs待办事项列表应用就绪事件,但有界的数据,我加入待办事项,data.html一个ready()
功能如下:聚合物 - 未就绪
<dom-module id="todo-data">
<template>
<style>
</style>
<firebase-collection location="{{userLocation}}"
data="{{fbTodos}}"
on-firebase-value="_firebaseLoaded">
</firebase-collection>
.....
</template>
<script>
Polymer({
is: 'todo-data',
properties: {
todos: {
notify: true
},
user: {
observer: '_userChanged'
},
.......
ready: function() {
console.log(this.user);
}
});
的user
属性价值是从index.html如下约束:
//index.html
<template is="dom-bind" id="app">
<todo-auth id="auth"
user="{{user}}"
location="[[firebaseURL]]"
user="{{user}}">
</todo-auth>
<todo-data location="[[firebaseURL]]"
todos="{{todos}}"
user="{{user}}">
</todo-data>
..........
我可以知道为什么用户总是打印为undefined
在ready()
?看起来,当调用ready()
时,有界数据还没有填充正确的数据。我什么时候可以可靠地知道有界数据何时被初始化?
感谢。我意识到,firebase-value事件是以某种方式解雇的。它可能来自嵌套元素。 :) – user3240644