I have created a custom component which i have placed in a for loop e.g
<div *ngFor="let view of views">
<customcomponent></customcomponent>
</div>
The output of which will be:
<customcomponent></customcomponent>
<customcomponent></customcomponent>
<customcomponent></customcomponent>
I would like to know how i can get a reference to these components using @viewchild syntax or any other means when the number of these components can vary
when the component can be given a name e.g
<customcomponent #compID></customcomponent>
I can then reference it as follows:
@ViewChild('compID') test: CustomComponent
How do i reference it when this is not the case e.g using an index possibly?
(This question does not relate to using ElementRef as per other questions that have been previously asked as can be seen by the answers listed below) This question relates to the accessing multiple @ViewChild and using list queries.