Angular dynamic table using ngFor

前端 未结 2 1167
孤街浪徒
孤街浪徒 2021-01-05 08:23

I would like to know if it is possible to create a dynamic HTML table from JSON data. The amount of columns and headers should change according to the keys in the JSON. For

2条回答
  •  孤独总比滥情好
    2021-01-05 09:02

    This can help:

    export class AppComponent {
     //Array of any value
      jsonData:any = [
        {id: "1", type: "bus", make: "VW", color: "white"},
        {id: "2", type: "taxi", make: "BMW", color: "blue"}
      ];
      _object = Object;
    }
    {{header}}
    {{ row[objKey] }}

提交回复
热议问题