![](/img/trans.png)
[英]Display sesstionStorage string in HTML view Angular 8?
[英]sesstionStorage cache system with Angular 2 is giving WebStorm errors
我有一个很大的数据结构,我希望避免在用户每次访问该页面时都进行API调用,因此我想将其存储在sessionStorage中。 我的this.fethData(market)
方法应处理sessionStorage中是否存在数据的逻辑。
这就是我所拥有的:
this.fetchingPromiseMap.set(market,
this.fetchData(market))
.toPromise().then((results: any) => {
this.sessionStorageService.setItem(market, results);
// the rest of the code isn't necessary for this question
方法如下:
private fetchData(market: string): Promise<any> {
return
this.http.get(`${this.getDispositionURL(market)}`).map((response)
=> response.json();
}
我有语法问题吗? 自从我进行了这些更改以来,我的WebStorm都有大量的红色字体。
您缺少一个结束)。 ... response.json() ) ;
private fetchData(market: string): Promise<any> {
return this.http.get(`${this.getDispositionURL(market)}`).map((response) => response.json());
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.