Reputation: 573
I have the following Angular 6 code:
https://stackblitz.com/edit/angular-pl9wkw
I'm tryin g to make the select dropdown reset to the place holder once a selection has been made. I am using these two lines to try and reference the process:
@ViewChild('selectDropdown') selectDropdown: MatSelect;
and
this.selectDropdown.AppComponent.reset();
Alas, it does not work to set the dropdown back to the placeholder. I know that it can be set back to the placeholder, because I have the blank <mat-option></mat-option>
selectable, and once you do select it, it sets it back to the placeholder.
Any thoughts ... anyone.
Upvotes: 3
Views: 5749
Reputation: 155
In your Onchange make following change
this.selectDropdown.value.reset();
Upvotes: 0
Reputation: 11101
In your onChange method make the following change.
this.selectDropdown.value = [];
// this.selectDropdown.AppComponent.reset();
Upvotes: 3