In my angular code, I am trying to assign a css color to my button and need to call a ts function to return the css class name.
I tried the following code
<button style="height: 10%" class="getColor(days.date)">{{days.date}}</button>
In my ts code,
I have something like this
getColor(item: any) {
return 'bg-green'; // define in my style.css
}
I quickly noticed that class="getColor()" does not even call the function.
I thought about ngIf and ngTemplate but not sure if that will work. I using setting to 4 different colors as indicators like default gray, blue, red, and yellow.
Any help is appreciated. Thanks.