Skip to content

MatSelectionList should update option selection state when list of options changes #16062

Closed
@benelliott

Description

@benelliott

What is the expected behavior?

MatSelectionList should update option selection state when list of options changes

What is the current behavior?

If you change the list of options after the view has been initialised, MatSelectionList does not update the model of the new options to reflect that they are selected in the model.

What are the steps to reproduce?

https://stackblitz.com/edit/angular-material2-issue-ptk4tc?file=app/app.component.ts

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

Latest StackBlitz template

Is there anything else we should know?

MatSelectionList should listen to options.changes on the options QueryList:

@ContentChildren(MatListOption, {descendants: true}) options: QueryList<MatListOption>;

This is how MatSelect works:

this.options.changes.pipe(startWith(null), takeUntil(this._destroy)).subscribe(() => {

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions