click on active ng class in angular code example
Example: onclick add active class in angular
You can do something like:
<ul class="sub_modules">
<li (click)="activateClass(subModule)"
*ngFor="let subModule of subModules"
[ngClass]="{'active': subModule.active}">
<a>{{ subModule.name }}</a>
</li>
</ul>
On The component
activateClass(subModule){
subModule.active = !subModule.active;
}
On the Ng class the first property is the class you wanna add and the second is the condition;