View source Improve this doc

ngStyle
directive in module ng

Description

The ngStyle directive allows you to set CSS style on an HTML element conditionally.

Usage

as attribute
<ANY ng-style="{expression}">
   ...
</ANY>
as class
<ANY class="ng-style: {expression};">
   ...
</ANY>

Parameters

ParamTypeDetails
ngStyleexpression

Expression which evals to an object whose keys are CSS style names and values are corresponding values for those CSS keys.

Example

Source







Demo