Pagination component for Angular2.
In root directory run:
npm install
to install Angular2 and other dependencies (including dev dependencies for running demo).grunt demo
- run
./demo/index.html
in your browser with running server
How to run server?
If you have installed Python you can use python -m SimpleHTTPServer 8000
in you root directory and then
http://0.0.0.0:8000/demo/.
Import component and make it as directive dependency for your application
import {Pagination} from '../../src/pagination';
@View({
directives: [
Pagination
],
...
})
Use it in HTML template:
<span>
Selected page: {{myActivePage}}
</span>
<pagination
<!-- required properties -->
[active-page]="myActivePage" <-- here is your app variable with current active page
[item-count]="463"
[items-per-page]="11"
[visible-pages]="4" <-- how many pages visible on sides
<!-- optional properties -->
[show-next-prev]="true"
[show-boundaries]="true"
(pageChanged)="onPageChange($event)"
text-left-boundary="«"
text-right-boundary="»"
text-next="Next page"
text-prev="Previous page"></pagination>