I am working with elements inside an ngFor loop. Each element is given a reference like #f{{floor}}b. The variable floor is used for this reference. My goal is to pass these elements to a function. Here is the code snippet:
<button #f{{floor}}b (click)="onClick(f{{floor}}b)"></button>
I attempted to do this, but it only passes a string like f5b instead of the actual element:
<button #f{{floor}}b (click)="onClick('f'+floor+'b')"></button>
Here is the full code snippet:
<div *ngFor="let floor of floors">
<button #f{{floor}}b (click)="onClick('f'+floor+'b')"></button>
</div>
The variable floor is a number, and floors is an array of numbers.