Components: [MatSelect] trigger MatSelectChange when setting the value with "writeValue" or "value"

Created on 20 Apr 2018  路  5Comments  路  Source: angular/components

Bug, feature request, or proposal:

Bug

What is the expected behavior?

Trigger the MatSelectChange when setting the select value programmatically

What is the current behavior?

The value of the dropdown is set, but no event is triggered

What are the steps to reproduce?

https://stackblitz.com/edit/angular-lkuscv

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

Angular Material 5.2.5

Most helpful comment

How would one then manually trigger that selectionChange to force the MatSelectTrigger to display desired text?

All 5 comments

The selectionChange event only fires when the value was changed by the user. From the docs:

Event emitted when the selected value has been changed by the user

The valueChange event should fire for all value changes.

How would one then manually trigger that selectionChange to force the MatSelectTrigger to display desired text?

How would one then manually trigger that selectionChange to force the MatSelectTrigger to display desired text?

Having the same issue here where a initial selection is not showing up 馃槥
@CAspeling did you find a solution?

@tdhulster I have not. I can't even get

    this.mySelect.selectionChange.emit(new MatSelectChange(this.mySelect, 'example text'));

to trigger the change if button of some kind got clicked.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

constantinlucian picture constantinlucian  路  3Comments

alanpurple picture alanpurple  路  3Comments

savaryt picture savaryt  路  3Comments

theunreal picture theunreal  路  3Comments

Miiekeee picture Miiekeee  路  3Comments