错误:AngularFireObject <{}>
无法分配为类型ObservableInput<{}>
getAuthenticatedUserProfile(){
return this.auth.authState
.map(user => user.uid)
.mergeMap(authId => this.afDatabase.object('/profile/'+authId))
.take(1)
}
答案 0 :(得分:3)
mergeMap
期望返回类型为ObservableInput<{}>
的值。您正在呼叫this.afDatabase.object('/profile/'+authId)
,这将返回AngularFireObject<{}>
调用valueChanges()
会将其转换为可观察的:
return this.auth.authState
.map(user => user.uid)
.mergeMap(authId => this.afDatabase.object('/profile/'+authId).valueChanges())
.take(1)
}