0

Let's say part of my code table looks like this. I'm using ngFor to access to the property of each element:

  <tr *ngFor="let hotel of tableData">
    <td>{{ hotel?.id }}</td>
    <td>{{ hotel?.name }}</td>
    <td>{{ hotel?.capacity }}</td>
    <td>{{ hotel?.phone_number }}</td>
    <td>{{ hotel?.web_site }}</td>
    <td>
      <span class="badge badge-success" *ngIf="hotel?.status === 'Active'"> {{ hotel?.status }}</span>
      <span class="badge badge-danger" *ngIf="hotel?.status === 'Inactive'">{{ hotel?.status }}</span>
    </td>

Is there a way to simplify the td tags making it more general? knowing that there is more types than just "hotel".

Cesar Augusto
  • 268
  • 4
  • 16

0 Answers0