【发布时间】:2019-03-13 09:13:45
【问题描述】:
错误:
[ts] Cannot invoke an expression whose type lacks a call signature. Type 'DatabaseSnapshot<any>' has no compatible call signatures.
(parameter) item: AngularFireAction<DatabaseSnapshot<any>>
文件消费服务:
**Error is at ...Item.payLoad().val()**
constructor(private service: EmployeeService) { }
ngOnInit() {
this.service.getEmployees().subscribe(list => {
let array = list.map(item => {
return { $key: item.key, **...item.payload().val()** }
})
});
}
**Method-II**
getEmployees() {
this.employeeList = this.db.list('employees');
return this.employeeList.snapshotChanges();
}
【问题讨论】:
-
请张贴代码,而不是图片。像这样帮助你真的很难。
-
我已经更改并在此处粘贴实际代码
标签: javascript angularjs typescript firebase-realtime-database