angular ngx-datatable ngFor行不显示数据

时间:2019-07-15 04:39:33

标签: angular ngx-datatable

我正在使用ngx-datatable,并且我想使用ngFor显示许多数据。 现在,表头已显示,但行单元格数据未显示。 如何解决这个问题?

<ngx-datatable [rows]="rows">                                                   
    <ngx-datatable-column [name]="col.name" *ngFor="let col of columns">                                                        
        <ng-template let-value="value" let-expanded="expanded" let-row="row" ngx-datatable-cell-template>                                                            
             {{ row.relevance }}                                                        
        </ng-template>                                                      
        <ng-template let-value="value" let-expanded="expanded" let-row="row" ngx-datatable-cell-template>                                                           
             {{row.name}}                                                       
        </ng-template>                                                                                                               
        <ng-template let-value="value" let-expanded="expanded" let-row="row" ngx-datatable-cell-template>                                                           
             {{row.price}}                                                      
        </ng-template>                                                                                                          
    </ngx-datatable-column>
</ngx-datatable>

columns = [
    { name: 'aaa' },
    { name: 'bbb' },
    { name: 'ccc' },
];
rows = [
    {   
        relevance: 'Austin', 
        name: 'Male', 
        price: 7
    },
    {   
        relevance: 'gfff', 
        name: 'des', 
        price: 4
    },
{   
        relevance: 'sosf', 
        name: 'qao', 
        price: 3
    }
];

0 个答案:

没有答案