Security News
CISA Brings KEV Data to GitHub
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
ng2-pagination
Advanced tools
This is a work-in-progress port of my angular-utils-pagination module from Angular 1.x to Angular 2.
Currently it is missing many features, but I hope to bring it eventually to full feature-parity with the 1.x version.
The API will not quite be the same, and it should be significantly simpler and easier to develop than the 1.x version.
I am currently working with TypeScript 1.7.3, so these instructions may not work with earlier versions.
npm install ng2-pagination --save
import {Component} from 'angular2/core';
import {CORE_DIRECTIVES} from 'angular2/common';
import {PaginatePipe, PaginationControlsCmp, PaginationService} from 'ng2-pagination';
@Component({
selector: 'my-component',
template: `
<ul>
<li *ngFor="#item of collection | paginate: [ITEMS_PER_PAGE or CONFIG_OBJECT] "> ... </li>
<ul>
<pagination-controls></pagination-controls>
`,
directives: [CORE_DIRECTIVES, PaginationControlsCmp],
pipes: [PaginatePipe],
providers: [PaginationService]
})
export class MyComponent {
public collection: any[];
constructor(private dataService: DataService) {
}
ngInit() {
this.dataService.getCollection()
.subscribe(result => this.collection = result);
}
}
The PaginatePipe should be placed at the end of an NgFor expression. It accepts a single argument, which should be
either a number
or an object confirming to IPaginationInstance
. If the argument is a number, the number sets the
value of itemsPerPage
.
Using an object allows some more advanced configuration. See the IPaginationInstance definition for an explanation of the available properties.
The following features from the 1.x version have not yet been implemented:
To build, first run npm install
to get all the dev dependencies. Then you can use the npm run build
script to
compile the TypeScript and generate the definition files. npm run test
will fire up Karma with the Webpack
plugin to run the tests.
MIT
FAQs
Pagination for Angular
The npm package ng2-pagination receives a total of 453 weekly downloads. As such, ng2-pagination popularity was classified as not popular.
We found that ng2-pagination demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.