I need to know a rendered element's height. I don't care if the element reports it or if the parent detects the height.
I've been researching this issue and I the number one root cause is that the :host element must have its display:block
set and I've done that. (Did I do it at the right level?)
this.nativeElement
dumps great info to the console.log but when I try to programmatically access the value it comes up "0".
Files:
img-fader.component.html
<img [src]='imgSrc' class="item carousel-item" style="width: 100%; display: block;"/>
img-fader.component.css
:host {
display: block;
}
img.carousel-item {
position: absolute;
left: 0;
}
img-fader.component.ts (Significant Portions)
export class ImgFaderComponent implements AfterViewInit {
@ContentChildren(ImgFaderComponent, {read: ElementRef}) imgList: QueryList<ElementRef>;
constructor() {}
ngAfterViewInit() {
this.imgList.forEach(img => console.log('Img: ', img.nativeElement.children[0].offsetHeight));
}
}