Issue
I am trying to pass values...I have this items list:
<ion-list id="items_list">
<ion-item *ngFor="let item of items_prods" (click)="callSettingsPage('{{item.ID}}', '{{item.State}}')">
<ion-item value="{{item.ID}}" >ID : {{item.ID}}<br/>STAT : {{item.State}}</ion-item>
</ion-item>
</ion-list>
and in this piece of code I have a (click) method where I call a function which should go to the other tab page:
callSettingsPage(id:string, state:string) {
this.myService.IdProd = id.toString();
this.myService.stateProd = state.toString();
alert("id: " + this.myService.IdProd + " - state: " + this.myService.stateProd);
}
But how I could pass those Id and State values to the function?
Thanks! Cheers!
Solution
Please try without {{ and ' (single quotes) because the ' tells angular to treat the inside value as string
<ion-list id="items_list">
<ion-item *ngFor="let item of items_prods" (click)="callSettingsPage(item.ID,item.State)">
<ion-item value="{{item.ID}}" >ID : {{item.ID}}<br/>STAT : {{item.State}}</ion-item>
</ion-item>
</ion-list>
Answered By - Shashank Vivek
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.