ng2-bootstrap
Version:
angular2 bootstrap components
72 lines (63 loc) • 3.21 kB
Markdown
### Usage
```typescript
import { PaginationModule } from 'ng2-bootstrap/ng2-bootstrap';
// or
import { PaginationModule } from 'ng2-bootstrap/components/pagination';
```
### Annotations
```typescript
// component Pagination
export class PaginationComponent implements ControlValueAccessor, OnInit, IPaginationConfig, IAttribute {
public maxSize:number;
public boundaryLinks:boolean;
public directionLinks:boolean;
// labels
public firstText:string;
public previousText:string;
public nextText:string;
public lastText:string;
public rotate:boolean;
// css
public pageBtnClass: string;
public disabled:boolean;
public get itemsPerPage():number {}
public get totalItems():number {}
public numPages:EventEmitter<number> = new EventEmitter(false);
public pageChanged:EventEmitter<IPageChangedEvent> = new EventEmitter(false);
export class PagerComponent extends Pagination {}
```
### Pagination properties
- `rotate` (`?boolean=true`) - if `true` current page will in the middle of pages list
- `disabled` (`?boolean=false`) - if `true` pagination component will be disabled
- `totalItems` (`number`) - total number of items in all pages
- `itemsPerPage` (`?number=10`) - maximum number of items per page. If value less than 1 will display all items on one page
- `maxSize` (`?number=undefined`) - limit number for page links in pager
- `boundaryLinks` (`?boolean=true`) - if `false` first and last buttons will be hidden
- `directionLinks` (`?boolean=true`) - if `false` previous and next buttons will be hidden
- `previousText` (`?string='Previous'`) - previous button text
- `nextText` (`?string='Next'`) - next button text
- `firstText` (`?string='First'`) - first button text
- `lastText` (`?string='Last'`) - last button text
- `pageBtnClass` (`?string=''`) - add class to `<li>`
### Pagination events
- `numPages` - fired when total pages count changes, `$event:number` equals to total pages count
- `pageChanged` - fired when page was changed, `$event:{page, itemsPerPage}` equals to object with current page index and number of items per page
### Pager properties
- `align` (`?boolean=true`) - if `true` aligns each link to the sides of pager
- `disabled` (`?boolean=false`) - if `true` pagination component will be disabled
- `totalItems` (`number`) - total number of items in all pages
- `itemsPerPage` (`?number=10`) - maximum number of items per page. If value less than 1 will display all items on one page
- `previousText` (`?string='Previous'`) - previous button text
- `nextText` (`?string='Next'`) - next button text
- `pageBtnClass` (`?string=''`) - add class to `<li>`
### Pager events
- `numPages` - fired when total pages count changes, `$event:number` equals to total pages count
- `pageChanged` - fired when page was changed, `$event:{page, itemsPerPage}` equals to object with current page index and number of items per page