toggle class on click angular code example
Example 1: angular onclick toggle class
// component.ts
toggleClass: boolean = false;
// component.html
<button (click)="toggleClass = !toggleClass" [ngClass]="{ 'button--grey': !toggleClass }">
Confirm
</button>
Example 2: angular ng-click toggle class
$scope.toggle = false;
<button id="btn" ng-click="toggle = !toggle" ng-class="{'red' : toggle}">Change Class</button>