getting error: "Property 'user' does not exist on type 'ArrayBuffer'. in Angular
getting error: "Property 'user' does not exist on type 'ArrayBuffer'. in Angular
所以我想在配置文件组件中显示用户信息,但是每当我 运行 服务器时,我都会收到两次相同的消息:属性 'user' 不存在于类型 'ArrayBuffer'。我试图查找它,但到目前为止我还不知道是什么原因造成的。谁能帮忙?
这是 profile.component.ts:
username;
email;
constructor(private auth: AuthService) { }
ngOnInit() {
this.auth.getProfile().subscribe(profile => {
this.username = profile.user.username;
this.email = profile.user.email;
})
}
尝试将响应更改为任何响应,在这种情况下,
this.auth.getProfile().subscribe((profile:any) => {
this.username = profile.user.username;
this.email = profile.user.email;
})
所以我想在配置文件组件中显示用户信息,但是每当我 运行 服务器时,我都会收到两次相同的消息:属性 'user' 不存在于类型 'ArrayBuffer'。我试图查找它,但到目前为止我还不知道是什么原因造成的。谁能帮忙? 这是 profile.component.ts:
username;
email;
constructor(private auth: AuthService) { }
ngOnInit() {
this.auth.getProfile().subscribe(profile => {
this.username = profile.user.username;
this.email = profile.user.email;
})
}
尝试将响应更改为任何响应,在这种情况下,
this.auth.getProfile().subscribe((profile:any) => {
this.username = profile.user.username;
this.email = profile.user.email;
})