Answer the question
In order to leave comments, you need to log in
How to get html element from ngFor Angular 2+?
How do I get the html element from ngfor? the crux of the matter is this. There is a list... on which I click and I can get the clicked element through (click)="myHandler($event)".... And if I need to do this during initialization? The bottom line is that I need to get the offset of this "active" element and assign the canvas element to its position .... i.e. on click I can, but without a click in ngOnInit I don’t understand how to do it....
https://stackblitz.com/edit/angular-gfq6kzHere you can see that when you click the circle changes its position. But when the component is initialized, there is already an active element, but I don’t know how to take the position of this element without clumsiness .... In fact, I can find the ViewChild of the list of items with ngOnInit and find this element in ChildNodes and pick up its left and right, but even I think this is a very bad idea. Moreover, the active element can change, and the quantity too
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question