如何使用 summaryFunc/summaryTemplate 格式化 ngx-datatable 中的摘要值?

How can I format the summary value in ngx-datatable with summaryFunc/ summaryTemplate?

我在我的 angular 项目中实现了 ngx-datatable,我需要显示我的 table 的摘要行。 根据文档,我使用了 [summaryFunc] 并且摘要值显示正确。 但现在我需要格式化这个值。 例如:1,000 美元而不是 1000 美元。

如何使用 [summaryFunc] 做到这一点?

<ngx-datatable
            #table
            class="material"
            [headerHeight]="40"
            [footerHeight]="40"
            [columnMode]="'flex'"
            [rowHeight]="'auto'"
            [summaryRow]="hasSummaryRow"
            [summaryHeight]="45"
            (resize)="onResize($event)"
            (reorder)="onReorder($event)"
            (activate)="onActive($event)"
            [loadingIndicator]="!items"
            [limit]="pageItems"
            [rows]="items"
            [count]="totalItems"
            [externalPaging]="externalPaging"
            [offset]="offset"
            (page)="onPaging($event)">
      <ngx-datatable-column *ngFor="let col of displayedColumns; let i=index"
                                  [name]="col.value"
                                  [flexGrow]="calculateWidth(col)"
                                  [sortable]="!col.columnType"
                                  [canAutoResize]="true"
                                  [resizeable]="!col.columnType"
                                  [summaryFunc]="sampleFunc"
                                  [summaryTemplate]="sampleTemplate">
      </ngx-datatable-column>
</ngx-datatable>
<ng-template #sampleTemplate let-value="value">
        <span>{{value|number}}</span>
</ng-template>

最后我自己找到了答案...在 summaryFunc 中我只需要声明新管道来格式化数字。