import {PaginationModule} from 'ng2-bs-pagination';
@NgModule({
imports: [ PaginationModule ],
declarations: [ AppComponent, TestPaginationComponent ],
bootstrap: [ AppComponent ]
})
import {Component, OnInit} from "@angular/core";
import {PaginationPipe, PaginationInterface} from "ng2-bs-pagination";
@Component({
moduleId: module.id,
selector: 'test-paginaion',
templateUrl: 'test-pagination.component.html',
providers: [PaginationPipe]
})
export class TestPaginationComponent implements OnInit {
collection: Array<{}>;
currentPage: number = 1;
totalItems: number = 200;
pageSize: number = 10;
public onPageChange(event: any): void {
this.currentPage = event.currentPage;
};
public paginationArgs() : PaginationInterface{
return {
currentPage : this.currentPage,
totalItems : this.totalItems,
pageSize : this.pageSize
}
}
ngOnInit(): void {
let collection = [];
for (let i = 0; i < 1000; i++) {
collection.push({
name: i
});
}
this.collection = collection;
}
}