Isa*_*yne 4 firebase typescript angular
在此代码片段中,我收到上述错误,因为“‘boolean’类型的参数无法分配给‘(value: string, index: number) => ObservableInput”类型的参数
onFileSelected(event: any, user: any){
this.crudservice.upload(event.target.files[0], `images/profile/${user.uid}`).pipe(
concatMap(res = > this.crudservice.updateProfileData({res}))
).subscribe()
}
Run Code Online (Sandbox Code Playgroud)
更具体地说,这一行:
res = > this.crudservice.updateProfileData({res})
Run Code Online (Sandbox Code Playgroud)
我将把它留在这里以供调用方法的参考:
updateProfileData(profileData: any){
const user = firebase.auth().currentUser
return of(user).pipe(
concatMap(user =>{
if(!user) throw new Error('Not Authenticated');
return updateProfile(user,profileData)
})
)
}
Run Code Online (Sandbox Code Playgroud)
= >问题是in之间的空格res = > this.crudservice.updateProfileData({res})。函数运算符之间不能有空格,否则它是大于布尔运算的赋值。
以下应该有效:
onFileSelected(event: any, user: any){
this.crudservice.upload(event.target.files[0], `images/profile/${user.uid}`).pipe(
// Fix here v
concatMap(res => this.crudservice.updateProfileData({res}))
).subscribe()
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6032 次 |
| 最近记录: |