I am trying to create a list of div elements which contains canvas elements using *ngFor directive in my Angular app. After (click) event on a particular canvas I would like to update the array (which I iterate over with *ngFor) at the relevant index and draw a shape on that canvas.
I've tried to set a reference to every canvas via #elementRef in my *ngFor loop and pass the reference to my drawing function (myDrawingFunction(elementRef)), but after array updates the function cannot properly locate the clicked canvas to draw on.
Do you have any suggestions what is the best approach to achieve this?
Thank you have much for any help!