[I'm using Ionic2 but I suppose this is actually an Angular 2 issue]
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)?
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.