Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular4 - Calculation in style bindings

Is there anyway you can do calculation in the style binding target in Angular4 ?

I've tried

[style.width]="{{1+1}}"

[style.width]="{{1+1}}px"

[style.width]="{{1px+1px}}"
like image 724
ekclone Avatar asked Oct 19 '25 02:10

ekclone


1 Answers

You can use [style.width.px]="1 + 1" in order to achieve that.

like image 57
QoP Avatar answered Oct 21 '25 22:10

QoP



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!