Take a look at my HTML code snippet
<mat-grid-list cols="3" rowHeight="150px">
<mat-grid-tile
*ngFor="let tile of tiles;index as j;"
[colspan]="tile.cols"
[rowspan]="tile.rows"
>
<div (onclick)="openbox();" style="z-index: 2">
{{tile.text}}<br>
<img src="https://images.unsplash.com/photo-1514888286974-6c03e2ca1dba?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1027&q=80" height="200px" width="260px">
</div>
</mat-grid-tile>
</mat-grid-list>
TypeScript section
export class RegistrationComponent implements OnInit {
...
openbox(){
console.log('clicked')
}
...
}
Methods I attempted:
style="z-index: 2; position: relative;"
Incognito
Browser Chrome Angular-9
I am aiming to retrieve the index of the clicked mat-grid-tile. Is there another approach to achieve this?
Thank you