HTML codes
<ion-item *ngFor="let data of datas">
<ion-button (click)="makefavorite(data)" > Make Favourite </ion-button>
</ion-item>
Typescript codes
makeFavorite(favData){
this.favStorage.set('id',favData.id);
//Storing data test
this.favStorage.get('id').then((val) => {
console.log('Saved post is', val);
}); //retrieving data test
}
The code shows above works just fine. I'm trying to build a list of data that comes from the server through an HTTP call.
This app should let users make lists favorite by clicking the button such as a bookmark or shopping cart.
Data variable is a JSON object contains id, title, content as properties.
Can anyone suggest me on How can I store any lists that user clicks, without overwriting the local storage variable?