In my HTML, I am using a div with an *ngFor loop to iterate through userList:
<div *ngFor="let user of userList">
<div>{{ Name }} </div>
</div>
Also, I have an object containing codes and colors:
[
{
"code": "A",
"color": "#0071e3"
},
{
"code": "B",
"color": "#ff0000"
},
{
"code": "C",
"color": "#249309"
},
..
]
The task is to match the starting letter of each Name in the userList with the code in the object and assign the corresponding color.