【问题标题】:usage of ngFor with ng template in ngx-datatable-column在 ngx-datatable-column 中使用 ngFor 和 ng 模板
【发布时间】:2018-10-10 09:44:31
【问题描述】:

我在这里遇到问题,我的 ngFor 没有显示任何数据,尽管没有堆栈错误或其他东西。

我想知道如何显示我的对象数组 - 称为“cldbAccounts” - 它必须包含对象并在同一列中显示它们的两个属性。

我的那部分代码

<ngx-datatable-column *ngIf="mode === 'contract' || mode === 'factorer'" name="CldbAccount" prob="cldbAccount">
   <ng-template let-column="column" height="200" let-onSort="sortFn" ngx-datatable-header-template>
      <span class="datatable-header-cell-wrapper">
      <span class="datatable-header-cell-label draggable" (click)="onSort()">CldbAccount</span>
      </span>
   </ng-template>
   <ng-template ngFor let-cldbAccount [ngForOf]="cldbAccounts">
      {{ cldbAccount.cldbAccount.cldbAccount }} [{{ cldbAccount.debitor.name }}]
   </ng-template>
</ngx-datatable-column>

我也尝试了这个答案 see here 的解决方案,但同样的问题存在

【问题讨论】:

    标签: angular ngfor ngx-datatable ng-template ng-container


    【解决方案1】:

    我发现问题只是我的代码中的一个错字,prob="cldbAccount" 应该是 prop="cldbAccount"

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-03-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多