You can use class
property binding
<p *ngFor="let item of data"><span [class.blue]="item.number === 1" [class.red]="item.number === 2" [class.green]="item.number === 3"> {{item.name}} </span> </p>
Alternatively you can use the [style.color]
property binding
<p *ngFor="let item of data"><span [style.color]="getColor(item.number)">{{item.name}}</span></p>getColor(number){ if(number ===1 ){ return 'blue'; }else if(number ===2 ) { return 'red'; } else if(number ===3 ) { return 'green'; }else { return ''; }}