ng2-pagination
Advanced tools
Comparing version 0.0.1-alpha.6 to 0.0.1-alpha.7
{ | ||
"name": "ng2-pagination", | ||
"version": "0.0.1-alpha.6", | ||
"version": "0.0.1-alpha.7", | ||
"description": "Pagination for Angular2", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -11,5 +11,3 @@ import {Component, Input, Output, EventEmitter} from 'angular2/core' | ||
@Component({ | ||
selector: 'pagination-controls', | ||
template: ` | ||
const DEFAULT_TEMPLATE = ` | ||
<ul class="pagination" role="navigation" aria-label="Pagination" *ngIf="!autoHide || pages.length === 0"> | ||
@@ -36,3 +34,3 @@ | ||
<li class="pagination-next" [class.disabled]="isLastPage()" *ngIf="directionLinks"> | ||
<a *ngIf="getCurrent() < pages.length" (click)="setCurrent(getCurrent() + 1)" aria-label="Next page"> | ||
<a *ngIf="!isLastPage()" (click)="setCurrent(getCurrent() + 1)" aria-label="Next page"> | ||
Next <span class="show-for-sr">page</span> | ||
@@ -44,3 +42,11 @@ </a> | ||
</ul> | ||
`, | ||
`; | ||
function getTemplate(): string { | ||
return PaginationService.template || DEFAULT_TEMPLATE; | ||
} | ||
@Component({ | ||
selector: 'pagination-controls', | ||
template: getTemplate(), | ||
directives: [CORE_DIRECTIVES] | ||
@@ -113,2 +119,4 @@ }) | ||
private createPageArray(currentPage: number, itemsPerPage: number, totalItems: number, paginationRange: number): IPage[] { | ||
// paginationRange could be a string if passed from attribute, so cast to number. | ||
paginationRange = +paginationRange; | ||
let pages = []; | ||
@@ -115,0 +123,0 @@ const totalPages = Math.ceil(totalItems / itemsPerPage); |
@@ -36,2 +36,7 @@ import {EventEmitter} from 'angular2/core' | ||
// static template config | ||
static templateUrl: string; | ||
static template: string; | ||
public register(instance: IPaginationInstance) { | ||
@@ -38,0 +43,0 @@ if (!instance.id) { |
43512
949