I am saving a product to localStorage and I need to delete the item from
localStorage. I am using
deleteItem(i){
localStorage.removeItem(i);
localStorage.setItem(i, JSON.stringify(this.items));
this.items.splice(i,1);
}
and I get the argument to the function from
<tr *ngFor="let item of items; let i = index">
<td>
<button type="button" (click)="deleteItem(i)">X</button></td>
</tr>
This isn't working. The product is still in localStorage after executing
the above code.
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/angular/80ea9b31-ffdd-4231-85b0-770061a8d16ao%40googlegroups.com.