export directive NgStyle
export directive NgStyle
exported from angular2/common defined in angular2/src/common/directives/ng_style.ts (line 9)
The NgStyle
directive changes styles based on a result of expression evaluation.
An expression assigned to the ngStyle
property must evaluate to an object and the
corresponding element styles are updated based on changes to this object. Style names to update
are taken from the object's keys, and values - from the corresponding object's values.
Syntax
<div [ngStyle]="{'font-style': style}"></div>
<div [ngStyle]="styleExp"></div>
- here thestyleExp
must evaluate to an object
Example (live demo):
In this example the font-style
, font-size
and font-weight
styles will be updated
based on the style
property's value changes.
Selectors
[ngStyle]
Inputs
ng-style
bound to NgStyle.rawStyle
Constructor
constructor(_differs: KeyValueDiffers, _ngEl: ElementRef, _renderer: Renderer)
constructor(_differs: KeyValueDiffers, _ngEl: ElementRef, _renderer: Renderer)
Not Yet Documented
Members
rawStyle
rawStyle
Not Yet Documented
ngDoCheck()
ngDoCheck()
Not Yet Documented