I have an array with names and same array with statuses (true, false). I am iterating through all names and creating buttons, and I want the button class to be btn-success if status of that element is true, and btn-danger if it is false. How can I make it? I tried with [ngClass] but it does not work.
app.component.html:
<div
*ngFor="let element of elements; let index = index"
(click)="changeStatus(index)"
[ngClass]="{'btn-success':statuses[index]===true}"
[ngClass]="{'btn-danger':statuses[index]===false}">
{{element}}
</div>
arrays in app.component.ts
elements = ['Element 1', 'Element 2', 'Element 3', 'Element 4', 'Element 5'];
statuses = [false, false, false, false, false];