AngularFire2嵌套*ngFor数组中的数组。。。但是Firebase没有';我没有数组。。。?

AngularFire2嵌套*ngFor数组中的数组。。。但是Firebase没有';我没有数组。。。?,firebase,firebase-realtime-database,nested,angularfire2,ngfor,Firebase,Firebase Realtime Database,Nested,Angularfire2,Ngfor,我正在使用AngularFire2,试图从列表中获取列表。 在*ngFor中嵌套的*ngFor不会显示在视图中 应用程序组件 ... constructor(private _af: AngularFire) { this.lists = this._af.database.list(this._API_URL); } ... app.component.html <div *ngFor="let list of lists | async"> {{sublist.

我正在使用AngularFire2,试图从列表中获取列表。 在*ngFor中嵌套的*ngFor不会显示在视图中

应用程序组件

...
constructor(private _af: AngularFire) {
    this.lists = this._af.database.list(this._API_URL);
}
...
app.component.html

<div *ngFor="let list of lists | async">
    {{sublist.name}}<br/> <!-- I can see you -->

    <!--******* I can't see you **********-->
    <div *ngFor="let rootword of list.rootwords">
        {{rootword.word}} {{rootword.total}}
    </div> 
</div>
如何使用firebase.list将ngFor嵌套在ngFor中?? 我需要映射还是过滤? AngularFire2是否有办法将内部对象转换为数组


感谢所有建议

可以使用and将
rootwords
对象替换为数组,如下所示:

导入'rxjs/add/operator/map';
建造师(私人建筑:AngularFire){
this.lists=this.\u af.database
.list(此.\u API\u URL)
//使用映射操作符替换列表中的每个项目:
.map(list=>list.map(item=>({
//映射到具有项目所有属性的新项目:
…项目,
//并用数组替换根字:
rootwords:Object.key(item.rootwords)
//使用reduce构建值数组:
.reduce((acc,key)=>[…acc,item.rootwords[key]],[])
})
));
}
或者,如果没有扩展语法:

导入'rxjs/add/operator/map';
建造师(私人建筑:AngularFire){
this.lists=this.\u af.database
.list(此.\u API\u URL)
.map(list=>list.map(item=>{
var copy=Object.assign({},item);
copy.rootwords=Object.keys(item.rootwords).reduce((acc,key)=>{
acc.push(项目根词[关键字]);
返回acc;
}, []);
返回副本;
}));
}

不起作用。。。从…项开始,应获取错误属性分配。。我是否必须导入另一个rxjs才能使用此语法?但对此进行了注释,仍然得到错误:ViewWrappedError错误:./LearnComponent类LearnComponent-内联模板:19:17中的错误,原因是:ViewWrappedError.ZoneWareerror()处管道“AsyncPipe”的无效参数“[object object object object],[object object],…”在ViewWrappedError.BaseError[作为构造函数]…注释掉了第二个|异步,现在是错误-预期的属性分配。仍然由…项引起您使用的是什么版本的TypeScript?TypeScript v2.1.1如果我手动添加项键,它将工作并删除内部的|异步管道。
maindb
  |_list1
  |  |_name: 'List 1"
  |  |_rootwords
  |     |_apple
  |     |   |_word: 'apple'
  |     |   |_total: 4
  |     |
  |     |_banana
  |     |   |_word: 'banana'
  |     |   |_total: 2
  |     |_carpet 
  |     |   |_word: 'carpet'
  |     |   |_total: 21
  |
  |_list2
     |_name: "List 2"
     |_rootwords
        |_elephant
        |    |_word: 'elephant'
        |    |_total: 4
        |_sloth
             |_word: 'sloth
             |_total: 5