【发布时间】:2020-11-23 23:01:15
【问题描述】:
GetUserDetailsById(Id): Observable<userdetails> {
return this.httpclient.get(this.BaseURI + '/user/UserDetailsById/' + Id).map((response: Response) => <userdetails>response.json())
}
1. constructor(private httpclient: HttpClient)
2. export class userdetails
{
idUser: number;
firstName: string;
lastName: string;
email: string;
permissions: string;
isActive: boolean;
displayRole: number;
}
删除 .map((response: Response) => response.json()) 时出错
Error : Type Observable<Object> is not assignable to type Observable我不想使用 .map((response: Response) => response.json()) 有什么建议吗?与 this.http 一起使用时,上面的代码工作正常
示例:
return this.http.get(this.BaseURI + '/user/UserDetailsById/' + Id).map((response: Response) => response.json())
- 构造函数(私有http:Http)
【问题讨论】: