Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to filter a boolean in angular

So I need to use these for true and false:

"pe-7s-close-check pe-lg pe-va text-success" "pe-7s-close-circle
pe-lg pe-va text-danger".

I have a html code:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

<tr *ngFor="let invoice of invoices; let i = index">
                            <td>{{ i + 1 }}</td>
                            <td>{{ invoice.number }}</td>
                            <td>{{ invoice.client.name }}</td>
                            <td>{{ invoice.paid }}</td>

invoice.paid is the boolean here,so when its paid it sould be green when not paid red how should I do it?
Something like this picture:

enter image description here

>Solution :

<tr *ngFor="let invoice of invoices; let i = index">
  <td>{{ i + 1 }}</td>
  <td>{{ invoice.number }}</td>
  <td>{{ invoice.client.name }}</td>
  <td>
  <i [ngClass]="{'pe-7s-close-check pe-lg pe-va text-success': invoice.paid, 'pe- 
  7s-close-circle pe-lg pe-va text-danger': !invoice.paid}"></i>
  </td>
</tr>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading