【发布时间】:2020-03-14 15:37:17
【问题描述】:
我有一个服务,它发送一个 get 请求来从我的 mongodb 集合中获取数据,我也想将传入的数据作为一个数组存储到本地存储中。
API.SERVICE.TS
getStorageLocationsList(){
this.setHeader();
return this.http.get(this.localURL + 'storagelocation/view' + '?userplant=' + this.userplant , {headers:this.appHeader});
}
COMPONENT.TS
this._api.getStorageLocationsList().subscribe(res => {
this.storagelocationsList = res as Event[];
//console.log(res);
}, err => {
console.log(err);
});
//I want some more code here to store the data in res to the localstorage
【问题讨论】:
标签: angular mongodb api get local-storage