How i change my color of text based on value

hey guys, I am new in ionic 2
i want to set my background color or text color of text based on value loaded.

in my code {{item.Remarks}} returns value ‘P’ or 'A’
i want to set color of text green if {{item.Remarks}} returns the value=P;
and color Red for value=A;

here is my code:

{{item.AttendanceDate}}
{{item.Remarks}}

you may get it this way

<div *ngIf="item.Remarks=='P'"  class="colorGreen"> {{item.Remarks}}</div>
<div *ngIf="item.Remarks=='A'" class="colorRed"> {{item.Remarks}}</div>

Thank u so much, its works. :slightly_smiling_face:

1 Like