Consider the following template:
<my-component #ref></my-component>
<my-comp-2 [maxWidth]="ref.clientWidth"></my-comp-2>
My component doesn't have a .clientWidth property on it, but the element itself that hosts my component does.
Is there a name I could use or some other similar solution for getting a reference to the element itself in the HTML alone? For instance, I would like to do something like this:
<my-component #ref="element"></my-component>
The problem is that there is no directive with the exportAs option named "element". Nor is there any built-in equivalent documented on the Angular site.
I am aware that I could add clientWidth as a property, and that I could get a reference to the element within <my-component> class via ElementRef<HTMLElement> and dependency injection, but I would like a solution that involves HTML alone. Does such a solution exist?