Dynamically loading columns and data in to table in Angular 2

后端 未结 7 913
醉话见心
醉话见心 2020-12-19 09:18

I have an HTML page in which I want to create a table. The columns in this table are dynamic which means that they are fetched from the server into a variable in the compone

7条回答
  •  情深已故
    2020-12-19 10:01

    This is for those who don't want table

    Header model:

    public tempData: any[] = [{
      header: 'Import',
      field: 'import'
    }, {
      header: 'Receive:',
      field: 'receive'
    }, {
      header: 'Send',
      field: 'send'
    }],
    

    Actual data:

    public actaulData: any[] = [
    { send: 'send to data', import: 'import data', receive: 'receive data'}]
    

    View:

    {{ item.header }}: {{ data[item.field] }}

提交回复
热议问题