小编Hol*_*lli的帖子

Angular 6 Error trying to diff '[object Object]'. Only arrays and iterables are allowed

I think my Problem is that the API delivers an Object instead of an array. So i need to Modify the Object to be an Array ?

How could this be done ? Object.assign ? Or Pipe ? Does anyone have a proper example ? I'am still learning Angular this is my second Project so i need some help ;)

thy so far !

Here is my code

getting data from API ..cant change the API it delivers an Object …

api fetch ngfor primeng angular

8
推荐指数
1
解决办法
3万
查看次数

Primeng可排序表指定已排序列

我有一个PrimeNG表,一切正常。我已经实现了排序。

我得到的是表中每个列的排序选项,但是我只希望在特定列中使用此选项。

有什么建议吗?

事先感谢

|| 威利..

<p-table [columns]="wikiCols" [value]="wikiItems" selectionMode="single" [(selection)]="selectedItem">
  <ng-template pTemplate="header">
    <tr>
      <th *ngFor="let col of wikiCols" [pSortableColumn]="col.field" >
        {{col.header}}
        <p-sortIcon [field]="col.field" ariaLabel="Activate to sort" ariaLabelDesc="Activate to sort in descending order" ariaLabelAsc="Activate to sort in ascending order"></p-sortIcon>
      </th>
    </tr>
  </ng-template>
  <ng-template pTemplate="body" let-rowData let-columns="columns">
    <tr [pSelectableRow]="rowData">
    <td *ngFor="let col of wikiCols">
      {{rowData[col.field]}}
    </td>
    </tr>
  </ng-template>
</p-table>
Run Code Online (Sandbox Code Playgroud)

primeng angular

1
推荐指数
2
解决办法
3917
查看次数

标签 统计

angular ×2

primeng ×2

api ×1

fetch ×1

ngfor ×1