[possibly angular 2 topic]
I have a component which is essentially a canvas on which things are drawn.
The drawing depends on the size of the component.
Setting the size using an Input-parameter is easy:
<my-component [width]="600" [height]="400"></my-component>
and in the code
@Input() private width: number;
@Input() private height: number;
...
paint() {
// use this.width...
}
However, I guess it would be more natural to set the size using a style sheet.
But then how can I find out the (current) width/height in the code (e.g. in paint())?
More in general: how can I access the current style of a component in code?
Related: is it possible to use onResize(event)
to find out when the size of the current component is changed (CSS changed)?