quoc bao Pham quoc bao Pham - 2 years ago 367
TypeScript Question

Angular Primeng cannot binding data by customer list

I have a rest api to get data, like as

async getAllTrainingClass(): Promise<void>{
await this.traningClassService.getListTrainingClass().then(data
=>this.listTraining = data);

try to show data on html, it's OK:

<p-dataTable [value]="listTraining" [rows]="5" [paginator]="true">

But I try to use the customer array, like as:

listData:MyClass[] = new Array<MyClass>();

and push data


on console.log the listData has 2 item, but when biding to html, data does not display.

<p-dataTable [value]="listData" [rows]="5" [paginator]="true">

please advice me.

Answer Source

Use [immutable]="false"

<p-dataTable [immutable]="false" [value]="listData" [rows]="5" [paginator]="true">

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download