Encountering an issue with paging on my angular 7 app where I am unable to assign exactpagelist of any type to pagefield of type array.
The problem seems to be occurring on the last line of the function totalNoOfPages at this point:
this.pageField = this.exactPageList;
this.pageField = 2; not correct
What I expected was:
this.pageField = [1,2];
This indicates that I need to convert this.exactPageList into an array in order to successfully assign it to pagefield. How can I achieve 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;
}
The output of the above code is as follows:
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
But what I am aiming for is:
this.pageField = [1,2];