test-pag v0.0.11
CosNgPagination
Pagination component for angular.
Install
The module can be installed using npm:
npm i cos-ng-pagination
Usage
Import CosNgPaginationModule from pagination-lib:
import { CosNgPaginationModule } from 'pagination-lib'
Add PaginationModule to the imports of your NgModule:
@NgModule({
declarations: [
AppComponent
],
imports: [
CosNgPaginationModule
],
exports: [],
bootstrap: [AppComponent]
})
export class AppModule { }
use in your templates to add pagination in your view like below
<cos-ng-pagination [total]="total" [currentPage]="currentPage" [perPage]="perPage" (pageChangedEvent)="onPageChange($event)"></cos-ng-pagination>
Options
total
Number The total number of items in the database.
perPage
Number The number of items to display per page.
currentPage
Number Current page (active) page number.
directionLinks
boolean If set to false, the "previous" and "next" links will not be displayed. Default is true.
pageChangedEvent
event handler The expression specified will be invoked whenever the page changes via a click on one of the pagination controls. The $event argument will be the number of the new page. This should be used to update the value of the currentPage variable which was passed to the PaginatePipe.