Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(expansion-panel): allow two-way binding on 'expanded' property #9311

Closed
okeydoky opened this issue Jan 9, 2018 · 1 comment · Fixed by #9327
Closed

feat(expansion-panel): allow two-way binding on 'expanded' property #9311

okeydoky opened this issue Jan 9, 2018 · 1 comment · Fixed by #9327
Assignees
Labels
feature This issue represents a new feature or feature request rather than a bug or bug fix help wanted The team would appreciate a PR from the community to address this issue P4 A relatively minor issue that is not relevant to core functions

Comments

@okeydoky
Copy link

okeydoky commented Jan 9, 2018

Bug, feature request, or proposal:

feature

What is the expected behavior?

allow two way binding on panel's expanded property

What is the current behavior?

Currently, 'expanded' is only an Input

What is the use-case or motivation for changing an existing behavior?

Right now, when we try to open/close panel programatically, we usually do something like:
<mat-expansion-panel [expanded]="isExpanded" (opened)="setExpanded(true)" (closed)="setExpanded(false)">

We cannot just set the model's property and rely on Angular's change detection to update the view because when a user interact with the UI, the expanded property value does not update on model's isExpanded property. We will need to bind opened and closed to update model to keep them in sync.

It would be nice and neat if we can somehow do this:
<mat-expansion-panel [(expanded)]="isExpanded">

then in the model file, we can just work on the isExpanded property without worrying that it might be out of sync with the view.

@jelbourn jelbourn added feature This issue represents a new feature or feature request rather than a bug or bug fix P4 A relatively minor issue that is not relevant to core functions help wanted The team would appreciate a PR from the community to address this issue labels Jan 9, 2018
@crisbeto crisbeto self-assigned this Jan 10, 2018
crisbeto added a commit to crisbeto/material2 that referenced this issue Jan 10, 2018
Supports two-way binding to the `expanded` property on the expansion panel.

Fixes angular#9311.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jan 10, 2018
* Supports two-way binding to the `expanded` property on the expansion panel.
* Fixes som wrong indentation in the tests.

Fixes angular#9311.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jan 10, 2018
* Supports two-way binding to the `expanded` property on the expansion panel.
* Fixes som wrong indentation in the tests.

Fixes angular#9311.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jan 10, 2018
* Supports two-way binding to the `expanded` property on the expansion panel.
* Fixes som wrong indentation in the tests.

Fixes angular#9311.
jelbourn pushed a commit that referenced this issue Jan 21, 2018
* Supports two-way binding to the `expanded` property on the expansion panel.
* Fixes som wrong indentation in the tests.

Fixes #9311.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jan 22, 2018
* Supports two-way binding to the `expanded` property on the expansion panel.
* Fixes som wrong indentation in the tests.

Fixes angular#9311.
jelbourn pushed a commit that referenced this issue Jan 23, 2018
…rty (#9327)

* Supports two-way binding to the `expanded` property on the expansion panel.
* Fixes som wrong indentation in the tests.

Fixes #9311.
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature This issue represents a new feature or feature request rather than a bug or bug fix help wanted The team would appreciate a PR from the community to address this issue P4 A relatively minor issue that is not relevant to core functions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants