I looked through a lot of posts, but nobody does what I want. I have a table that goes beyond the page width and for various reasons I need to get its width.
I used:
@ViewChild('tableToMeasure') elementView: ElementRef;
And then put #tableToMeasure in the table. However, this seems like a mistake:
ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'nativeElement' of undefined
Even if it works and only on the parent div of the page.
Any ideas? I need to get its width both for loading the page, and for resizing the page, and change the other width of the divs to one value.
source
share