angular2动态更改样式属性值

Niy*_*yaz 4 angular

我需要更新图像的变换旋转值,该值随时间动态变化

我尝试过类似下面的东西,但它没有用

style="transform: rotate(imagerotation ? imagerotation : 0 + deg);"

实现这个目标的正确方法是什么?

Sas*_*sxa 10

试试这个:

[style.transform]="'rotate(' + (imagerotation ? imagerotation : 0) + 'deg)'"
Run Code Online (Sandbox Code Playgroud)