I have a Component and I use it in this way:
<ImgList>
<img src="../assets/img/file1.jpg" width="30px" height="20px" />
<img src="../assets/img/file2.jpg" width="30px" height="20px" />
</ImgList>
I want in export class ImgListComponent to take a reference to the first image, I tried:
@ContentChildren('img', {read: ElementRef}) imgEls: QueryList<ElementRef>;
and in:
ngAfterContentInit() {
console.log(this.imgEls.toArray[0])
}
but console displays undefined.