Is there a way to add a class from the .ts file, using Angular solutions
<div [class.extra-sparkle]="isDelightful == true">
I want to do the above but from the side of the .ts file. The less code the better.
<button class="general" (click)="ChangeScreen('Global')" [class.selected]="CurrentPage == 'Global'">Global</button>
<button class="general" (click)="ChangeScreen('Maintenance')" [class.selected]="CurrentPage == 'Maintenance'">Maintenance</button>
<button class="general" (click)="ChangeScreen('Settings')" [class.selected]="CurrentPage == 'Settings'">Settings</button>
<button class="general" (click)="ChangeScreen('Profile')" [class.selected]="CurrentPage == 'Profile'">Profile</button>
<button class="general" (click)="ChangeScreen('Transactions')" [class.selected]="CurrentPage == 'Transactions'">Transactions</button>
I would like to just add something like this into the ChangeScreen function:
ChangeScreen(page) {
page.addClass = page;
}
Then I can remove all of those lines: [class.selected]="CurrentPage == '...'"