Good morning, I'm developing an app with ionic 3 and I have the following situation:
I am writing a list of products in the localStorage, after that, I need to bring the recorded data to a list of products, that is, each vector item, creates a column in the list. Code:
Write to LocalStorage:
localStorage.setItem("vetor", JSON.stringify(this.vetCarrinho));
Recover from LocalStorage:
ionViewDidLoad() {
if (this.pedido.key) {
let prod: any = localStorage.getItem('vetor').split(",");
if (prod != null) {
prod = JSON.parse(prod);
if (this.vetCarrinho.indexOf(prod) === -1) {
this.vetCarrinho.push(this.pedido.produto);
}
}
}
Html:
<ion-list>
<ion-item *ngFor="let element of vetCarrinho">
{{element}}
<button ion-button color="danger" (click)="deleteProduto(element)" item-end>
<ion-icon name="trash"></ion-icon>
</button>
</ion-item>
</ion-list>
From this, it plays ALL the elements in JUST ONE COLUMN:
How do I create a column for each element?