ionic2 - ion-list item issue


#1

I am trying to give an ion-item inside of an ion-list a dynamic id. I then want to click on the item and get the id. The problem is the ion-item width is so small it has to be clicked perfectly for it work. I have submitted a bu as it looks like a CSS issue (https://github.com/driftyco/ionic/issues/5863), but I am in a rush and was looking for a workaround. Has anyone been able to get this to work?


#2

Not sure what you’re trying to do here but assigning dynamic id’s seems strange, why not just pass a local reference to the item through a click handler, i.e using the code from the issue you created:

<ion-list> 
    <ion-item *ngFor="#item of items" (click)="doSomething(item)">{{item.fullname}}</ion-item> 
</ion-list>

Also, if you have a clickable list you should use:

<button ion-item></button>

instead of:

<ion-item></ion-item>

as it will avoid a tap delay on mobiles.