My array consists of 5 string values: excited, happy, neutral, sad, angry.
To simplify my HTML and avoid repeating code for each value, I am utilizing ngClass and ngFor.
The challenge I'm facing is that the ngClass statement is quite lengthy, and I'm struggling to find a more concise way to write it. Is there a shorter approach to achieve the same result?
<mat-icon *ngFor="let smiley of smileys" svgIcon="emote_{{smiley}}"
[ngClass]="{ happy: smiley === 'happy', sad: smiley === 'sad', neutral: smiley === 'neutral', angry: smiley === 'angry', excited: smiley === 'excited'}" (click)="selected(smiley, $event)"></mat-icon>
I appreciate your assistance!