I have detected a bug in Angular 4 or PrimNG Datatables module.
I have a simple view:
<span *ngFor="let node of nodes">{{node.label}}</span> //works with case 1,2,3 and 4
<p-dataTable [value]="nodes"> //works with case 1, 2, and 3 (but not with 4!)
<p-column field="label" header="Label"></p-column>
</p-dataTable>
and code in component:
private nodes:any[] = []
ngOnChanges() {
//case 1 -> ok
//this.nodes.push({label: 'foo'})
//case 2 -> ok
//this.nodes = [{label: 'foo'}]
this.someService.getAll().subscribe(
records => {
//case 3 ->ok
//this.nodes = [{label: 'foo'}]
//case 4 -> BUG
//this.nodes.push({label: 'foo'}) //datatable is not updated
}
)
}
When I run this code with uncommented case 1, 2 or 3 everything is OK but when I am trying to run case 4 (same as case 1 but after service resolve) - prim ng datatables seem not to see changes. In Angular 2 I did not have such issue. Could you explain me what is going on here? :)
Regards