我正在使用firebase for database。试图获取数据并将其显示在角度6表中。
这是接口和组件类。
export interface BrandElement {
name: string;
image: string;
}
export class BrandComponent implements OnInit {
displayedColumns = ['name'];
//dataSource = new MatTableDataSource(ELEMENT_DATA);
dataSource = new MatTableDataSource<BrandElement>();
constructor(private _router: Router, private _af: AngularFireDatabase) {
this.dataSource.data = this._af.list('/all-brands').valueChanges();
}
}
构造函数中的行给出错误
[ts]
Type 'Observable<{}[]>' is not assignable to type 'BrandElement[]'.
Property 'includes' is missing in type 'Observable<{}[]>'.
如何解决此问题?