I have just started a new project with angular and I learnt abount *ngIf. I would like to use *ngIf in order to add / remove a class from a div
Before click
<div class="done">Foo</div>
After click
<div class="notdone">Foo</div>
You have different ways of approaching this.
<div [ngClass]="{'done': conditionToDone, 'notdone': !conditionToDone}">Foo</div>
Where done or notdone are added via a condition.
[ngClass]="condition ? 'done' : 'notdone'".
ngClassinstead ofngIfread from herehttps://angular.io/api/common/NgClass