Hi, I have to execute a function (save(…,…,…,…) ) each time I pass in a ngFor loop on my code. It work when I click on my div.
<ion-card (click)="showInter(item.HISTO_N, item.HISTO_Comm1, item.HISTO_Titre, item.L4_Livraison, item.HISTO_Objet2)" *ngFor="let item of items">
<div id="clickDiv" #divSave (click)="save(item.HISTO_N, item.HISTO_Comm1, item.HISTO_Titre, item.L4_Livraison, item.HISTO_Objet2)">save</div>
.
.
.
RaulGM
September 16, 2019, 10:46am
2
Sorry, I did not understand your question nor your code. If you try to explain it better, I will be happy to help.
To share a code, set a double space line and four spaces before your code starts.
I receive with Ionic storage an array of object, I display each object in each ion-card element, and with my div I’m trying to create Storage space for each object I receive with HISTO_N as key.
here is my function to receive data in my array :
getData() {
this.storage.get(this.getParameter()).then((val) => {
if (val != null && val !== undefined ) {
this.items = val;
this.items.push(val);
}
});
}
Here I display data of each object in ion-card
<ion-card (click)="showInter(item.HISTO_N, item.HISTO_Comm1, item.HISTO_Titre, item.L4_Livraison, item.HISTO_Objet2)" *ngFor="let item of items">
<!--<p>{{save(item.HISTO_N, item.HISTO_Comm1, item.HISTO_Titre, item.L4_Livraison, item.HISTO_Objet2)}}</p>-->
<div id="clickDiv" #divSave (click)="save(item.HISTO_N, item.HISTO_Comm1, item.HISTO_Titre, item.L4_Livraison, item.HISTO_Objet2)">save</div>
…
</ion-card
I would like a Storage space for each ion-card content with HISTO_N as key
My save function :
save(HISTO_N, HISTO_Comm1, HISTO_Titre, L4_Livraison, HISTO_Objet2) {
let d = {
com : HISTO_Comm1,
titre : HISTO_Titre,
livr : L4_Livraison,
obj : HISTO_Objet2
};
this.storage.set(HISTO_N, d);
}
Thanks