How to pass element data to click event using angular 2?

I would like to parse the data from my element into a (click) -Event, but I think it is throwing errors (the app is suddenly empty).

How can I get item.HostName as a parameter to my click event?

<ion-card *ngFor="let item of data" (click)="gotoEvent('{{item.HostName}}')">
  <p>{{item.UserName}}</p>
</ion-card>

      

thanks and kind

+3


source to share


1 answer


just remove the covering paranthesis '{{}}'

, pass it as a normal variable



<ion-card *ngFor="let item of data" (click)="gotoEvent(item.HostName)">
  <p>{{item.UserName}}</p>
</ion-card>

      

+2


source







All Articles