Project

General

Profile

1
import {Component, Input, Output, EventEmitter} from '@angular/core';
2

    
3
@Component({
4
    selector: 'search-results-per-page',
5
    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
            <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
          </mat-select>
18
        </mat-form-field>
19
      </div>
20
    `
21
})
22

    
23
export class SearchResultsPerPageComponent {
24
    @Input() isDisabled: boolean = false;
25
    @Input() size: number;
26
    @Output() sizeChange  = new EventEmitter();
27

    
28
    constructor () {}
29

    
30
    ngOnInit() {}
31

    
32
    sizeChanged() {
33
      this.sizeChange.emit(this.size);
34
    }
35
}
(40-40/47)