ngOnInit() {
this.dtOptions = {
pagingType: 'full_numbers',
pageLength: 2
};
this.dtOptions = {
pagingType: 'full_numbers',
pageLength: 2
};
this.allservice.getUrl(this.listUserUrl)
.subscribe(data=>{
this.listUser=data.responseContents
});
}
## angular.json:
"styles": [
"src/styles.css",
"node_modules/datatables.net-dt/css/jquery.dataTables.css"
],
"scripts": [
"node_modules/jquery/dist/jquery.js",
"node_modules/datatables.net/js/jquery.dataTables.js"
]
<table datatable [dtOptions]="dtOptions" class="row-border hover">
<thead>
<tr>
<th class="text-center width-10"> Name
</th>
<th class="text-center"> User Name
</th>
</tr>
</thead>
<tbody>
<tr *ngFor = "let i = index ; let x of listUser ">
<td class="text-center">{{x.name}}</td>
<td>{{x.username}}</td>
</tr>
</tbody>
</table>
In this Iam trying to use datatable on first loading Im getting the data in table but If I do any sort r filter,pagenation it showing No data Found.I dont no where Im making mistake can any one help to solve this problem.