ahmed elbarbary

ahmed elbarbary

  • NA
  • 1.6k
  • 275.4k

How to solve error length with null when click page number ?

May 13 2020 8:36 PM
I work on angular 7 app I face problem
 
when press to paging it as press page number 2 it give me error i dont know why this error
 
done my error as below :
 
main-es2015.85811b324d3ec20b9963.js:1 ERROR TypeError: Cannot read property 'length' of null
at Object.updateDirectives (main-es2015.85811b324d3ec20b9963.js:1)
at Object.updateDirectives (main-es2015.85811b324d3ec20b9963.js:1)
at Ly (main-es2015.85811b324d3ec20b9963.js:1)
at Gy (main-es2015.85811b324d3ec20b9963.js:1)
at Wy (main-es2015.85811b324d3ec20b9963.js:1)
at Ly (main-es2015.85811b324d3ec20b9963.js:1)
at Gy (main-es2015.85811b324d3ec20b9963.js:1)
at qy (main-es2015.85811b324d3ec20b9963.js:1)
at Ly (main-es2015.85811b324d3ec20b9963.js:1)
at Gy (main-es2015.85811b324d3ec20b9963.js:1)
Er @ main-es2015.85811b324d3ec20b9963.js:1
main-es2015.85811b324d3ec20b9963.js:1 count rows is 855
 
this function is fired when press page number as below
  1. showReportsByPageNumber(page, i) {  
  2. this.reportdetailslist=[] ;  
  3. this.pageNumber = [];  
  4. this.pageNumber[i] = true;  
  5. console.log("value of page " + this.pageNumber[i])  
  6. console.log("value of i " + i)  
  7. this.searchData.PageNumber = page;  
  8. this.getalldatareports();  
  9. }  
  10. <ul class="pagination justify-content-center">  
  11. <li *ngFor="let page of pageField;let i=index" class="page-item">  
  12. <a (click)="showReportsByPageNumber(page,i)" [ngClass]="pageNumber[i] ? 'pageColor':'page-link'"  
  13. style=" margin-right: 5px;;margin-top: 5px">{{page}}</a>  
  14. </li>  
  15. </ul>  
why this error display

Answers (1)