I have encountered several posts, but none of them quite achieve what I am trying to do. I am dealing with a table that exceeds the width of the page and, due to certain requirements, I need to measure its width.
I attempted:
@ViewChild('tableToMeasure') elementView: ElementRef;
And then added #tableToMeasure to the table. However, this resulted in an error:
ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'nativeElement' of undefined
Even though it works only on the parent div of the page.
Any suggestions? I need to determine its width both on page load and when the page is resized, and adjust another div's width accordingly.