Skip to content

mat-select not pre selecting a value when mat-option has async content #7923

@Almar

Description

@Almar

Bug, feature request, or proposal:

Bug

What is the expected behavior?

When the ngModel of a mat-select is populated on page load the mat-select should have that option selected.

What is the current behavior?

mat-select does not show the current selected option on page load if a mat-option has some async behaviour, in my case the translate pipe:

        <mat-option *ngFor="let option of options" [value]="option.value">
          {{ option.label | translate }}
        </mat-option>

The current selected option is shown the moment the mat-select gets focus.

What are the steps to reproduce?

Please have a look at the following StackBlitz example:
https://stackblitz.com/edit/angular-material2-issue-async-mat-option-label?file=app%2Fpet-select-async%2Fpet-select-async.component.ts

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

material beta 12
angular 4.4.3

Metadata

Metadata

Assignees

Labels

P2The issue is important to a large percentage of users, with a workaround

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions