【问题标题】:Angular Material Table not showing array data inside dataSource objectAngular Material Table 未显示 dataSource 对象内的数组数据
【发布时间】:2018-12-19 20:29:37
【问题描述】:

行为示例:

https://stackblitz.com/edit/angular-ctyf9w

为什么我无法使用 *ngFor 显示数据?一些文档中是否有任何示例说明如何根据其他列显示数据和行跨度?

【问题讨论】:

    标签: angular angular-material


    【解决方案1】:

    您没有正确使用 ngFor。在您的情况下,您不需要索引。更改您的代码:

    <div *ngFor="let price of product.prices; let i = index;">        
        {{ price[i].price }}
    </div>
    

    收件人:

    <div *ngFor="let price of product.prices">        
        {{ price.price }}
    </div>
    

    这是你的working forked project

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-18
      • 2018-11-13
      • 2020-05-14
      相关资源
      最近更新 更多