npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ngx-pager

v1.0.6

Published

A pagination plugins for **Angular**.

Downloads

241

Readme

ngx-pager

A pagination plugins for Angular.

Build Status Support Support Support Support Support License

Please support this project by simply putting a Github star. Share this library with friends on Twitter and everywhere else you can.

Table of contents:

Getting started

Installation

npm install ngx-pager --save

Implementation

import "NgxPagerModule" in your application module. For example: app.module.ts

import {NgxPagerModule} from  'ngx-pager';
@NgModule({
    imports:[
	    NgxPagerModule
	    ...
    ]
})
export  class  AppModule { }

add styles in your application stylesheets. For example: styles.scss

@import  "~ngx-pager/themes/ngx-pager";

add configration in your component. For example : app.component.ts

import {HttpClient} from  '@angular/common/http';

export  class  AppComponent  implements  OnInit {
pagerConfig: any = null;
totalRow: any = null;
result: Array<any> = [];

constructor(private  http:  HttpClient){}
ngOnInit() {
   this.pagerConfig  = {
	    perPage:3,
		displayPageCount:  3,
		firstLastView:true,
		    render: (page)=> {
				this.http.get('<API URL>')
				.subscribe((responseData:any)=>{
					this.totalRow = responseData.totalRows;
					this.result = responseData.list;
				})
			}
		};
    }
}

			

If want to change the url with query string after every page change, append redirect parameter with config.For example: url like http://localhost:4200/home?page=1

redirect : {
  type :'q', // q=query string
  param : 'page'// param name
},

If want to change the url with url parames after every page change, append redirect parameter with config. For example: url like http://localhost:4200/home/flag-one/1/flag-two

redirect: {
	type :  'p',
	param: {
		path :  './home',
		name :  'page',
		params: {
		    flagOne: 'flag-one',
			page:  null,
			flagTwo: 'flag-two'
		}
   }
},

Add ngx-pager html tag in your component html. For example : app.component.html

<ngx-pager  [config]="pagerConfig"  [totalrow]='totalRow'></ngx-pager>
  • [config] : to set the pagination configuration
  • [totalrow]: to set the total rows of data list

Settings Option

| |Description |Default Value |Required | |----------------|-------------------------------|-----------------------------|-----------------------------| |perPage| number of records display in every page | | yes | |displayPageCount| number of pages show in pagination panel | 3 | | |simple| only show next and prev buttons | false | | |firstLastView| first last buttons will display | false | | |redirect| redirection configuration after click on page button | | | |redirect.type| page render with query string or page parameter | q=query string, p= url params | yes| |redirect.param| if redirect.type=q name of the query string parameter. For example: http://current-url?page=1. redirect.param='page' | | yes| |redirect.param.path| if redirect.type=p name of the url. for example: redirect.param.path='./home' | | yes(only redirect.type=p)| | redirect.param.name | if redirect.type=p name of the url params which content the page no. for example: http://current-url/{page}/{slug_1}/{slug_2}. redirect.param.name='page' | | yes(only redirect.type=p)| | redirect.param.params | if redirect.type=p all url params list. it's object type data. For example: redirect.param.params = { "page":null, "slug_1":"cont-1", "slug_2":"cont-2" } | | yes(only redirect.type=p)| | customContent| to change the prev,next,first,last button html | {"prev":"&#10094;", "next":"&#x276F;", "first":"&#10094; &#10094;", "last":"&#x276F; &#x276F;"} | | | render| event to rendering the list with paginnation | | yes |

Demo

Click Here for the demo

Creator

Tonmoy Nandy

License

The MIT License (MIT)