question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is it possible to not use ellipsis in ngx-pagination?

See original GitHub issue

Angular version: 5.2.9

ngx-pagination version:4.0.0

Description of issue: I’m using ngx-pagination package and trying to implement this:

pagination-1

But this is what I have until now:

pagination-2

My HTML:

<pagination-controls responsive="true" directionLinks="false"></pagination-controls>

My CSS:

.ngx-pagination {
    .current {
        background: orange;
    }
}
  • Do you know if would it be possible to put more space between the different items? Thus incrementing the width of the component.
  • In case of more width available, show more numbers instead of ellipsis (…).
  • Show a dot (like a bullet) between the numbers. For this I have found this. But doesn’t work well, it shows the dots below the numbers. Only works for the current number. See below: pagination-3

Stackblitz: https://stackblitz.com/edit/angular-xbh9ft

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
michaelbromleycommented, Jul 11, 2019

Glad it helped you!

As a detail, I have observed this DOM element inside the <pagination-controls> (the default, not the custom one) that, I guess, is for responsive mode:

Yes, that’s right.

For small screen support in your custom template, you can just include the markup in the same custom template, and use CSS to show or hide it with a media query. Here’s how the default template markup/css looks:

 <li class="small-screen">
    {{ p.getCurrent() }} / {{ p.getLastPage() }}
 </li>
@media screen and (max-width: 601px) {
  .ngx-pagination.responsive .small-screen {
    display: inline-block; } 
  .ngx-pagination.responsive li:not(.small-screen):not(.pagination-previous):not(.pagination-next) {
    display: none; }
}
1reaction
michaelbromleycommented, Jul 9, 2019

Hi!

For the styling, you can either override the CSS styles (which I see you have attempted in the StackBlitz) or, if you want more control, create your own custom template so you have full control over the markup.

Based on the desired style in your first image, I’d say you’d probably need to go with a custom template to get that effect with the dots in between the numbers.

In case of more width available, show more numbers instead of ellipsis (…).

There is the maxSize input which will cause more pages to be displayed before using the ellipsis.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it possible to not use ellipsis in ngx-pagination?
No, they don't. The <ul> element's width (the one with the .ngx-pagination class) changes, but the distance between the numbers is ...
Read more >
Is it possible to not use ellipsis in ngx-pagination?-angular.js
Finally, I opened an issue in the package's Github repo and could achive what I wanted. I had to implement a custom template....
Read more >
Ngx-Bootstrap - Pagination - Tutorialspoint
As we're going to use a pagination, We've to update app.module.ts used in ngx-bootstrap Modals chapter to use PaginationModule and PaginationConfig.
Read more >
Angular 10 Pagination example | ngx-pagination - BezKoder
In this tutorial, I will show you how to make Pagination example in an Angular 10 Application with existing API (server-side pagination) using...
Read more >
ngx-pagination | Yarn - Package Manager
4.0.0 (2019-06-12). Breaking Changes. Lib is now built with Angular 8. This means it uses the version 4 metadata format and will no...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found