<mat-form-field *ngIf="!filterOption.allowSearch; else withSearch" class="filtering-input-width">
  <mat-label i18n>Select a value...</mat-label>
  <mat-select [(ngModel)]="selectedValue" cdkTrapFocus cdkTrapFocusAutoCapture>
    <mat-option *ngFor="let choice of choices" [value]="choice.value">
      {{ choice.display }}
    </mat-option>
  </mat-select>
</mat-form-field>
<ng-template #withSearch>
  <div>
    <mat-form-field class="full-width">
      <mat-label i18n>Select a value...</mat-label>
      <input matInput placeholder="Select a value..." i18n-placeholder
             [matAutocomplete]="auto" (ngModelChange)="onChange($event)"
             [(ngModel)]="selectedValue" cdkTrapFocus cdkTrapFocusAutoCapture>
      <button mat-icon-button *ngIf="selectedValue" matSuffix (click)="clearSelection()"
              aria-label="Clear" i18n-aria-label>
        <mat-icon>close</mat-icon>
      </button>
      <mat-autocomplete #auto="matAutocomplete">
        <mat-option *ngFor="let choice of filteredChoices" [value]="choice.value">
          <span>{{ choice.display }}</span>
        </mat-option>
      </mat-autocomplete>
    </mat-form-field>
  </div>
</ng-template>
<div><!--pushes checkbox on new line--></div>
<mat-checkbox [(ngModel)]="exclude" [color]="'primary'" i18n>Exclude</mat-checkbox>
<div class="fl-margin-top-medium"><!--pushes button on new line--></div>
<button (click)="applyFiltering()" mat-flat-button i18n>
  Apply
</button>
