I work on angular 7 app I face issue on paging cannot assign exactpagelist any to pagefield any[] .
because pagefield is type array and exactpagelist is type any .
issue exist on last line of function totalNoOfPages on this line
this.pageField = this.exactPageList;
this.pageField = 2; not correct
I expected to be
this.pageField = [1,2];
meaning i need to convert this.exactPageList; to array to be accepted assign to pagefield How to do that ?
pageField:any[];
exactPageList:any;
totalNoOfPages() {
this.paginationData = Number(this.totalReportCount / this.ReportPerPage);
console.log("pagination data :" + this.paginationData)
let tempPageData = this.paginationData.toFixed();
console.log("tempPageData data :" + tempPageData)
if (Number(tempPageData) < this.paginationData) {
this.exactPageList = Number(tempPageData) + 1;
this.paginationService.exactPageList = this.exactPageList;
console.log("exactPageList1 data :" + this.exactPageList )
} else {
this.exactPageList = Number(tempPageData);
this.paginationService.exactPageList = this.exactPageList
console.log("exactPageList2 data" + this.exactPageList )
}
this.paginationService.pageOnLoad();
this.pageField = this.exactPageList;
}
Result of code above as below :
pagination data1.0666666666666667
reportdetails.component.ts:265 tempPageData data1
reportdetails.component.ts:269 exactPageList1 data2
reportdetails.component.ts:263 pagination data1.0666666666666667
reportdetails.component.ts:265 tempPageData data1
reportdetails.component.ts:269 exactPageList1 data2
Expected result
this.pageField = [1,2];