如何获取phase
和places
的项目?我的目标是编写一个函数getSelectOptions(key:string)
,它返回一个列表,用于显示所提供密钥的选择选项。我想通过从firebase获取select-options
然后在函数内返回子集来将数据库查询减少到1。我到目前为止:
this.selectOptions = af.database.list('/select-options');
答案 0 :(得分:1)
这是一种可能对您有所帮助的解决方法,但必须有另一种方法:
this.selectOptions.subscribe(items=> {
for(let options of items){
for (var property in options) {
if (options.hasOwnProperty(property) && property.indexOf("$")!=0){
console.log(options[property]); //Should contain an object phase.
}
}
}
});