Skip to content

Commit 8b7a5d0

Browse files
committed
fix(pagination): displays 1 of 0 pages
1 parent 8050482 commit 8b7a5d0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/pagination/pagination.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,12 @@ export class Pagination {
231231
* @memberof Pagination
232232
*/
233233
get lastPage(): number {
234-
return Math.ceil(this.model.totalDataLength / this.model.pageLength);
234+
let last = Math.ceil(this.model.totalDataLength / this.model.pageLength);
235+
return last !== 0 ? last : 1;
235236
}
236237

237238
get startItemIndex() {
238-
return (this.currentPage - 1) * this.model.pageLength + 1;
239+
return this.endItemIndex !== 0 ? (this.currentPage - 1) * this.model.pageLength + 1 : 0;
239240
}
240241

241242
get endItemIndex() {

0 commit comments

Comments
 (0)