Click event not working

I’m trying to call a function on click, but nothing seems to happen. Please check the below code:

    <ion-list inset>
        <ion-item *ngFor="let cat of categories" (click)="sample()">
            <ion-avatar item-left>
              <img src="assets/img/{{cat.image}}.png" alt="{{cat.altName}}">



No click event is working.

Check out the documentation for Items. Particularly you should be using a button in this situation with the ion-item attribute set.

Taken from docs:
<button ion-item (click)="buttonClick()"> Button Item </button>

You could also just add the tappable attribute to your ion-items

1 Like

Thank you, it worked.