Project

General

Profile

1 53918 konstantin
import {Component, Input, Output, EventEmitter} from '@angular/core';
2
3
@Component({
4
    selector: 'search-results-per-page',
5 58258 konstantin
    template: `
6
      <div>
7
        <mat-form-field class="matSelectionFormField">
8
          <mat-label>Results per page:</mat-label>
9
          <mat-select  [(ngModel)]="size" (ngModelChange)="sizeChanged()"
10
                       [disableOptionCentering]="true"
11
                       panelClass="matSelectionPanel"
12
                       class="uk-text-bold matSelection">
13 59115 konstantin
            <mat-option [value]="5"  [disabled]="isDisabled"> 5</mat-option>
14
            <mat-option [value]="10" [disabled]="isDisabled">10</mat-option>
15
            <mat-option [value]="20" [disabled]="isDisabled">20</mat-option>
16
            <mat-option [value]="50" [disabled]="isDisabled">50</mat-option>
17 58258 konstantin
          </mat-select>
18
        </mat-form-field>
19
      </div>
20 53918 konstantin
    `
21
})
22
23
export class SearchResultsPerPageComponent {
24 59115 konstantin
    @Input() isDisabled: boolean = false;
25 53918 konstantin
    @Input() size: number;
26
    @Output() sizeChange  = new EventEmitter();
27
28
    constructor () {}
29
30 54775 konstantin
    ngOnInit() {}
31 53918 konstantin
32
    sizeChanged() {
33 59155 konstantin
      this.sizeChange.emit(this.size);
34 53918 konstantin
    }
35
}