Skip to content

Commit 8515022

Browse files
authored
Merge pull request #372 from youda97/emtpy-pagination
fix(pagination): displays 1 of 0 pages
2 parents 3488f8e + f49970f commit 8515022

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+
const 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)