Commit 4f8446c3 authored by Matthieu Benoist's avatar Matthieu Benoist
Browse files

change button link to a link for pagination for indexation with rendertron

parent dc01e602
......@@ -31,11 +31,13 @@
<ul>
<ng-container *ngFor="let pageNum of getPages(); let i = index">
<li>
<button *ngIf="!loading; else pageNumberDisabled"
[attr.aria-label]="pageNum"
(click)="onPage(pageNum)" class="button"
[ngClass]="{'is-current': pageNum === pageIndex}"
[attr.aria-current]="pageNum === pageIndex ? 'page' : undefined">{{ pageNum }}</button>
<a *ngIf="!loading; else pageNumberDisabled"
[attr.aria-label]="pageNum"
(click)="onPage(pageNum);" class="button"
href="{{ currentUrl }}?page={{ pageNum }}"
[ngClass]="{'is-current': pageNum === pageIndex}"
[attr.aria-current]="pageNum === pageIndex ? 'page' : undefined">{{ pageNum }}</a>
<ng-template #pageNumberDisabled>
<button class="button" [ngClass]="{'is-current': pageNum === pageIndex}"
[attr.aria-current]="pageNum === pageIndex ? 'page' : undefined" disabled>{{ pageNum }}</button>
......
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { ViewportScroller } from '@angular/common';
import { Router } from '@angular/router';
@Component({
selector: 'app-paginator',
......@@ -20,12 +21,16 @@ export class PaginatorComponent implements OnInit {
@Output() pageSizeChanged = new EventEmitter<number>();
pageSizeDropdownToggle = false;
currentUrl: string;
constructor(
private _viewportScroller: ViewportScroller,
private _router: Router
) { }
ngOnInit() {
const url = this._router.url.split('?');
this.currentUrl = url[0];
}
onPrev() {
......@@ -42,9 +47,11 @@ export class PaginatorComponent implements OnInit {
}
}
onPage(n: number): void {
onPage(n: number): boolean {
this.scrollTop();
this.page.emit(n);
return false;
}
totalPages(): number {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment