Typescript Ionic3和AngularFire2过程可观测到目标阵列

Typescript Ionic3和AngularFire2过程可观测到目标阵列,typescript,rxjs,angularfire2,Typescript,Rxjs,Angularfire2,我在将返回的数据从AngularFire2移动到代码中的数据结构时遇到一些问题。简单获取对象列表的基本方法对我很有用,但我正在尝试将一个更简单的列表处理成数组 我在Firebase(V4.10.1,AngularFire2 V5.0.0-rc.6)中的数据位于 我的数据在列表中为:格式。我想将此返回数据处理到一个typescript数组teamName['ABC']='teamName a' 我可以使用:this.AfDb.list(Location.snapshotChanges().subs

我在将返回的数据从AngularFire2移动到代码中的数据结构时遇到一些问题。简单获取对象列表的基本方法对我很有用,但我正在尝试将一个更简单的列表处理成数组

我在Firebase(V4.10.1,AngularFire2 V5.0.0-rc.6)中的数据位于

我的数据在列表中为:格式。我想将此返回数据处理到一个typescript数组
teamName['ABC']='teamName a'

我可以使用:
this.AfDb.list(Location.snapshotChanges().subscribe(console.log))获取数据并将其放入console.log()中

我在尝试处理数据时遇到问题:

private Data_:{};

constructor(AfDb:AngularFirebaseDatabase) {
    const AfData:Observable<{}> = this.AfDb.list(Location).snapshotChanges();
    AfData.subscribe(list => {
            list.forEach(OneRec => {
                this.Data_[OneRec.key] = OneRec.payload.val();
            });
        });
}
私有数据{};
建造商(非洲开发银行:AngularFirebaseDatabase){
const AfData:Observable=this.AfDb.list(Location.snapshotChanges();
AfData.subscribe(列表=>{
list.forEach(OneRec=>{
this.Data[OneRec.key]=OneRec.payload.val();
});
});
}
我得到一个错误,我的键值[OneRec.Key]。
core.js:1350错误类型错误:无法设置未定义的属性“ABC”。


我试过使用数据:any;也没有成功。最近我打开了Ionic中的TSLint函数,这就是我尝试定义所有变量的原因。

您没有初始化
Data\uuuuu
只设置了类型,因此它是未定义的


私有数据{}

正确,但我仍然没有得到所需的数组。我希望将数据填充到一个数组中以使用它,键是来自AngularFire2的数据,然后是来自AngularFire2的内容和结果。
private Data_:{};

constructor(AfDb:AngularFirebaseDatabase) {
    const AfData:Observable<{}> = this.AfDb.list(Location).snapshotChanges();
    AfData.subscribe(list => {
            list.forEach(OneRec => {
                this.Data_[OneRec.key] = OneRec.payload.val();
            });
        });
}