以下带有angularfire2的ionic 4 angular中的代码在编译时引发错误
src / app / data-service.service.ts(267,3)中的错误:错误TS1005:“,”。
getGallery() {
return new Promise((resolve, reject) => {
this.db.list('/gallery', ref => ref.orderByKey().limitToLast(5))
.snapshotChanges()
.pipe(map(items => { // <== new way of chaining
return items.map(a => {
const data = a.payload.val()
const key = a.payload.key
return {key, data} // or {key, ...data} in case data is Obj
})
}))
.subscribe(
(res:any) => {
//console.log('stat is:' + JSON.stringify(res))
resolve(res)
},
err => {
console.log("failed in validate:" + err)
reject(err)
}
)
}
}