[Solved] how to understand angular ng-class and dynamic class [closed]


In the base, it works like:

  • You create some class (css/scss)
  • You bind that class dynamicly to your html element based on some condition.

Example

isBlack = true;
div.my-dynamic-class {
  background-color: #000000;
  }
<div [ngClass]="{'my-dynamic-class': isBlack}"></div>

where isBlack would be the boolean based on that class will be applied.

Here is the complete documentation: LINK

2

solved how to understand angular ng-class and dynamic class [closed]