Angular add class dynamically
<button
*ngFor="let button of buttons"
class="general"
(click)="ChangeScreen(button.label)"
[class.selected]="CurrentPage == button.label">
{{ button.label }}
</button>
Angular add class dynamically
<button
*ngFor="let button of buttons"
class="general"
(click)="ChangeScreen(button.label)"
[class.selected]="CurrentPage == button.label">
{{ button.label }}
</button>
angular ngclass
content_copy
<some-element [ngClass]="'first second'">...</some-element>
<some-element [ngClass]="['first', 'second']">...</some-element>
<some-element [ngClass]="{'first': true, 'second': true, 'third': false}">...</some-element>
<some-element [ngClass]="stringExp|arrayExp|objExp">...</some-element>
<some-element [ngClass]="{'class1 class2 class3' : true}">...</some-element>
angular dynamic class
<button [ngClass]="type === 'mybutton' ? namespace + '-mybutton' : ''"></button>
Angular add class dynamically
buttons: Array<{label: string}> = [
{
label: 'Global'
},
{
label: 'Maintenance'
},
{
label: 'Settings'
},
{
label: 'Profile'
},
{
label: 'Transactions'
}
]
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us