How to get child of tapped item in List View?


When using:

  [items]="listData | async"

  <ng-template nsTemplateKey="test" let-item="item">
    <GridLayout rows="auto, auto" columns="*">
      <Label row="0" class="label-1" [text]="item.label_1"></Label>
      <Label row="1" class="label-2" text]="item.label_2"></Label>



  // ????

Any ideas how to figure out which label was tapped?

For example, if the entire item was tapped on first label, how do we get “label-1” reference? Using IDs, # or similar is also acceptable I guess?

I am aware that using (tap) on each label is exactly what I want. But what about performance issues? Would it defeat the point of using List Views?


Aren’t you looking for the args.index by any chance? This will give you the list tap index of each template row.


I wish :slightly_smiling_face:

Surely it should be possible to have multiple tap zones in the same row / item?


If you need to split the taps between the labels then I would go with tap on each, it should be fine for normal length lists. You can also try to name each as #lb1 #lb2 and see if you get them on your main itemTap event - I haven’t tried.