I have a cart service where I want to store and get items from it. I can store however the get
returns a promise.
How do I get the data? How do resolve the promise? I never used them before.
If I print, it's fine, but I need to use it outside:
this.items=[];
if(localforage.length()!=0){
localforage.getItem('items').then(function (data) {
this.items.=data;
});
//this.items=this.getData();
//this.items.push(NewItems);
console.log(this.items);
//console.log(this.items);
}
Can someone help me please?