Skip to content

[MdListOption] selected value not checked when accessing MdSelectionList.selectedOptions.selected #7183

@glampr

Description

@glampr

Bug, feature request, or proposal:

Bug

What is the expected behavior?

If a MdListOption's has its @Input('selected') value set to true upon initialization, it should be included in the selectedOptions.selected attribute of its enclosing MdSelectionList.

What is the current behavior?

The MdListOption's initial @Input('selected') value is not respected when accessing the selectedOptions.selected attribute of its enclosing MdSelectionList.
An option that has its initial selected value to true is not included in the selectedOptions.selected but when it is subsequently click and thus gets unselected, then it is included in the selectedOptions.selected attribute of its MdSelectionList.

What are the steps to reproduce?

http://plnkr.co/edit/CXc5dKsoNWzU89s3endl?p=preview

Click the 'Show selected' button.
Then uncheck the selected option ('two') and click again on 'Show selected'.

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

Angular: 4.3.0
Material: 2.0.0-beta.10
Typescript: 2.3.2

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions