Reputation:
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>
Upvotes: 1
Views: 57
Reputation: 2391
You have different ways of approaching this.
<div [ngClass]="{'done': conditionToDone, 'notdone': !conditionToDone}">Foo</div>
Where done
or notdone
are added via a condition.
Upvotes: 1