Arm144
Arm144

Reputation: 773

Show selected value in material select

I have this code and I am wondering how can I be able to show the selected value on the label. Thank you!

Upvotes: 0

Views: 102

Answers (1)

user4676340
user4676340

Reputation:

This should do the trick : stackblitz

<mat-form-field>
    <mat-select #select [placeholder]="selectedLanguage?.value?.value || 'Language'" (selectionChange)="selectedLanguage = $event"
     panelClass="panelResponsive">
        <mat-option *ngFor="let language of filteredLanguages" [value]="language">
            <span>{{language.value}}
            </span>
        </mat-option>
    </mat-select>
</mat-form-field>

Upvotes: 2

Related Questions