【发布时间】:2020-10-19 16:26:09
【问题描述】:
这是我的订阅变量,它从配置设置中获取 api
public ChannelsAPI=this._configservice.getConfiguration("ChannelAPI").subscribe((result) => console.log(result));
这是我的 _Configservice.getConfiguration 方法
getConfiguration(key) {
return this._http.get('./assets/config/' + this._env + '.json').map(res => {
this.result = res.json();
return this.result[key];
});
}
这是我收到错误的地方
this.ChannelsApi 可疑字符串,但它正在获得订阅,这就是我收到错误的原因
getChannels(): Observable<Channeldata[]> {
return this.httpClient.get<Channeldata[]>(this.ChannelsAPI) >>>> *ERROR PLACE*
.pipe(
catchError(this.errorHandler)
)
}
【问题讨论】:
-
几周前我问过同样的问题。 stackoverflow.com/questions/63956168/…
标签: angular