How to merge cells in the table dynamiclly

Viewed 288

I would like to merge cells in a table, I know the most obvious way - using the rowspan attribute.

 <table>
   <tr>
      <th rowspan="2">data</th>
      <td>
        first_data_element: 1 second_data_element: "abc"
      </td>
    </tr>
    <tr>
      <td>
        first_data_element: 2 second_data_element: "xyz"
      </td>
    </tr>
  </table>

However, in fact my table in created dynamically - cells content is get from a database - so I have to use *ngFor directive

<table>
  <tr>
      <th rowspan="2">data</th>
      <td *ngFor="let el of data.dataElement">
        species: {{el.firstDataElement}} weight: {{el.secondDataElement}}
      </td>
    </tr>
</table>

However this doesn't work, Note that teh value of rowspan is permanently entered. What I need is enter image description here

1 Answers
Related