NgClass

Stable

Directive

What it does

Adds and removes CSS classes on an HTML element.

How to use

<some-element [ngClass]="'first second'">...</some-element> <some-element [ngClass]="['first', 'second']">...</some-element> <some-element [ngClass]="{'first': true, 'second': true, 'third': false}">...</some-element> <some-element [ngClass]="stringExp|arrayExp|objExp">...</some-element> <some-element [ngClass]="{'class1 class2 class3' : true}">...</some-element>

Class Overview

class NgClass implements DoCheck {
constructor(_iterableDiffers: IterableDiffers, _keyValueDiffers: KeyValueDiffers, _ngEl: ElementRef, _renderer: Renderer)

klass 
ngClass 
ngDoCheck() : void

}

Selectors

[ngClass]

Class Description

Constructor

constructor(_iterableDiffers: IterableDiffers, _keyValueDiffers: KeyValueDiffers, _ngEl: ElementRef, _renderer: Renderer)

Class Details

exported from common/index, defined in common/src/directives/ng_class.ts