I've looked at numerous posts but none quite do what I want it to do. I have a table which goes outside the width of the page and for various reasons I need to get it's width.
I used:
@ViewChild('tableToMeasure') elementView: ElementRef;
And then put #tableToMeasure on the table. However this seems to error:
ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'nativeElement' of undefined
Even though this works on and only on the parent div of the page.
Any ideas? I need to get it's width on both page load and page resize and change another divs width to be the same value.