垂直 table 具有动态标题和动态值 angular

Vertical table with dynamic headings and dynamic values in angular

考虑我的场景,我有 2 个来自服务调用的列表,一个列表将用作 table 标题,另一个列表将用作 table 数据。 像这样---

列表 1 - [姓名、年龄]

列表 2 - [Shubham,25 岁​​]

Table 应该看起来像 -

Name    Shubham
Age     25

另一个例子...

清单 1 - [DOC1, DOC2]

列表 2 - [待定,已批准]

DOC1    Pending
DOC2    Approved

有人能帮忙吗?

这样试试:

Working Demo

<table>
    <ng-container *ngFor="let item of list1;let i = index">
        <tr>
            <td> {{list1[i]}}</td>
            <td> {{list2[i]}}</td>
        </tr>
    </ng-container>
</table>