// GET DEVICES LIST
getDevices(): Observable < DeviceList > {
this.setToken();
return this.http.get<DeviceList>(this.api_url + '/devices', this.httpOptions1)
.retry(2);
}
我不知道该情况该怎么做,我创建了模型并尝试获取devicelist
,因此将模型添加到api.service
但出现此错误`< / p>
ERROR in src/app/services/api.service.ts(86,9): error TS2322: Type 'Observable<HttpEvent<DeviceList>>' is not assignable to type 'Observable<DeviceList>'. Type 'HttpEvent<DeviceList>' is not assignable to type 'DeviceList'. Type 'HttpProgressEvent' is not assignable to type 'DeviceList'. Property 'device_family' is missing in type 'HttpProgressEvent'.
答案 0 :(得分:0)
您正在使用使用Rxjs 6.3的Angular 7
添加运算符的语法如下:
getDevices(): Observable<DeviceList> {
this.setToken();
return this.http.get<DeviceList>(this.api_url + '/devices', this.httpOptions1)
.pipe(
retry(2)
);
}
这是您推荐的Working Sample StackBlitz。