Research
Security News
Malicious PyPI Package ‘pycord-self’ Targets Discord Developers with Token Theft and Backdoor Exploit
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
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, CORE_DIRECTIVES} from 'angular2/angular2';
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 876 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.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.