-1
一個對象的單個值當我撥打電話,以火力點我回來的快照,如何訪問該快照內的單個值?這是我有:我怎麼使用AngularFire2 ListObservable
topics: FirebaseListObservable<any[]>;
constructor(af: AngularFire) {
this.topics = af.database.list('/topics',{preserveSnapshot: true});
this.topics.subscribe(snapshots => {
snapshots.forEach(snapshot => {
console.log(snapshot.key)
console.log(snapshot.val())
});
});
該代碼將打印到控制檯類似的東西:
Object {desc: "Answer questions about music!", imgURL: "seta.png", lang: "eng", published: true, title: "Music"}
可以說,我只是想從那裏標題,我該怎麼辦呢?從火力地堡的JavaScript文檔我想出了一個解決方案