The `ngStyle` directive allows you to set CSS style on an HTML element conditionally.
The ngStyle
directive allows you to set CSS style on an HTML element conditionally.
This directive executes at priority level 0.
Usage
as attribute
<ANY ng-style="{expression}">
...
</ANY>
as class
<ANY class="ng-style: {expression};">
...
</ANY>
Parameters:
Needs Expression which is an object whose keys are CSS style names and values are corresponding values for those CSS keys. Since some CSS style names are not valid keys for an object, they must be quoted.
References