Reputation: 43
Can some please help not sure why ngClass is not getting applied in this code
[ngClass]="{'active': isActive,'can-toggle':canToggle}"
Upvotes: 0
Views: 44
Reputation: 31125
The member variables isActive
and canToggle
are wrongfully defined as types true
and false
. It should actually be assigned the booleans instead
isActive = true;
canToggle = false;
Modified Stackblitz.
Upvotes: 1
Reputation: 4228
Change this :
isActive:true;
canToggle:false;
to this :
isActive = true;
canToggle = false;
Upvotes: 1