Pd.*_*ung 2 javascript firebase firebase-realtime-database
this.fb.getShoppingItems().then(result =>{
this.exercises=result;
console.log("this exercise : ");
console.log(this.exercises);
})
Run Code Online (Sandbox Code Playgroud)
我应该列出Firebase数据,但出现如下错误
找不到类型为“对象”的其他支持对象“ [对象对象]”。NgFor仅支持绑定到Iterables,例如数组。
第一个图片是我的Firebase数据结构,第二个图片是console.log结果。
在html中,我应该遍历来自firebase数据的练习(interval_time,name,rest_time,time)
我想我应该重复一下。对于每个日期节点,例如20170710/20170711 ...我该怎么做?
对于JavaScript我会做
firebase.database().ref("profile/user_id").on('value', function(snap){
snap.forEach(function(childNodes){
//This loop iterates over children of user_id
//childNodes.key is key of the children of userid such as (20170710)
//childNodes.val().name;
//childNodes.val().time;
//childNodes.val().rest_time;
//childNodes.val().interval_time;
});
});
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
4361 次 |
最近记录: |