<ng-container *ngIf="pageCount">
    <ng-container *ngIf="pageList.length>1">
        <button [disabled]="pageIndex===0"
                (click)="pageIndexChange.emit(pageIndex-1)">&lt;</button>
        <ng-container *ngIf="!pageList.includes(0)">
            <button (click)="pageIndexChange.emit(0)">1</button>
            <span *ngIf="!pageList.includes(1)">...</span>
        </ng-container>
        <button *ngFor="let p of pageList"
                [class.active]="pageIndex===p"
                (click)="pageIndexChange.emit(p)">{{p+1}}</button>

        <ng-container *ngIf="!pageList.includes(pageCount-1)">
            <span *ngIf="!pageList.includes(pageCount-2)">...</span>
            <button (click)="pageIndexChange.emit(pageCount-1)">{{pageCount}}</button>
        </ng-container>
        <button [disabled]="pageIndex===pageCount-1"
                (click)="pageIndexChange.emit(pageIndex+1)">&gt;</button>
    </ng-container>
</ng-container>