Skip to content
Snippets Groups Projects
generic-select.component.html 1.25 KiB
<mat-form-field>
    <mat-select [id]="selectId" [placeholder]="label" [(value)]="selectedValue" [multiple]="isMultiple">
        <mat-select-trigger *ngIf="isMultiple">
            {{ selectedValue && selectedValue[0] ? entryLabel(selectedValue[0]) : '' }}
            <span *ngIf="selectedValue?.length > 1" class="multiple-selection-label">
                (+ {{ selectedValue.length - 1 }} {{ selectedValue?.length === 2 ? uitextAndOther : uitextAndOthers }})
            </span>
        </mat-select-trigger>
        <mat-option *ngFor="let e of entries" [value]="e" [title]="entryLabel(e)">
            {{ entryLabel(e) }}
        </mat-option>
    </mat-select>
    <button mat-button *ngIf="showClearButton" matSuffix mat-icon-button aria-label="Clear"
        (click)="selectedValue=[]; $event.stopPropagation()">
        <mat-icon>close</mat-icon>
    </button>
    <div *ngIf="enableHelpButton" class="overlap-select">
        <mat-icon id="help-select" (click)="openHelp($event)" [title]="uitextOpenHelp" color="accent">
            help
        </mat-icon>
    </div>
</mat-form-field>
<div *ngIf="messageWhenEmpty" class="message-when-empty">
    {{ messageWhenEmpty }}
</div>
<div *ngIf="errorMessage" class="message-when-empty">
    {{ errorMessage }}
</div>