I need to update a transform rotate value of image which dynamically change over the time
I tried something like below, but it isnt worked
style="transform: rotate(imagerotation ? imagerotation : 0 + deg);"
What is the proper way to achieve this ?
color = "red"; you can apply the style change dynamically. Below is a function that turns an element's colour to red when you pass it the element's id . You could also use setAttribute(key, value) to set a style on an element. For example, you could set the colour of an element to red by calling element.
ngStyle is an Angular directive that gives you the flexibility to do this, where as style is a regular HTML property to which you can only bind values one by one. That's the difference between the two of them.
Try this:
[style.transform]="'rotate(' + (imagerotation ? imagerotation : 0) + 'deg)'"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With