ngx-materialize icon indicating copy to clipboard operation
ngx-materialize copied to clipboard

pagination breaks after totalItems = 0

Open Spoilt opened this issue 4 years ago • 1 comments

Expected Behavior

Show pages number instead of NaN when TotalItems passes through 0 (zero)

Current Behavior

totalItems

Steps to Reproduce (for bugs)

Stackblitz

Your Environment

  • Version used: 6.1.3 (Stackblitz: 6.0.0)
  • Angular version used: 7.2.13 (Sb: 6.0.3)
  • Browser Name and version: Chrome 80.0.3987.132 (64bits), Firefox 74.0b9 (64 bits)
  • Operating System and version (desktop or mobile): Windows 10
  • Link to your project (if appropriate): N/A

Spoilt avatar Mar 09 '20 14:03 Spoilt

Ugly workaround from hell :

  • Copied MzPaginationModule, pasted it in my app.
  • Fixed some imports
  • renamed selectors to app-mz-pagination...
  • replaced in pagination.component.ts line 20 :
// before
return Math.ceil(this.totalItems / this.itemsPerPage);
// after
return Math.ceil((this.totalItems || 1) / this.itemsPerPage);

Spoilt avatar Mar 09 '20 16:03 Spoilt