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

Sidenav - provide means to open/close from non-child elements #2591

Closed
robwormald opened this issue Jan 10, 2017 · 3 comments · Fixed by #2870
Closed

Sidenav - provide means to open/close from non-child elements #2591

robwormald opened this issue Jan 10, 2017 · 3 comments · Fixed by #2870
Assignees
Labels
feature This issue represents a new feature or feature request rather than a bug or bug fix P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@robwormald
Copy link
Contributor

Bug, feature request, or proposal:

Given usage like:

<md-sidenav-container>
  <md-sidenav>
    <ul></ul>
  </md-sidenav>
  <my-component></my-component>
</md-sidenav-container>

Because my-component is not a child of the md-sidenav element, you can't inject MdSidenav into it, which makes programmatically toggling the Sidenav rather difficult (either you end up having to @ViewChild() query for it, and wiring that all up through your own service)

What is the expected behavior?

Developers should have an easy way to programmatically control the md-sidenav

What is the current behavior?

See above

Is there anything else we should know?

Material 1 provided a $sideNav service, which is the kind of thing i'm describing here: https://material.angularjs.org/latest/api/service/$mdSidenav

@jelbourn jelbourn added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent feature This issue represents a new feature or feature request rather than a bug or bug fix labels Jan 12, 2017
@EladBezalel
Copy link
Member

@jelbourn do we want to stick with the component-id functionality from material1 or do you have something else in mind?

@jelbourn
Copy link
Member

jelbourn commented Jan 12, 2017

@robwormald I took a look at this, and MdSidenavContainer does let you do this already. The tricky thing is that the container can have two MdSidenav instances (one on the left and one on the right). You get these through sidenavContainer.start and sidenavContainer.end. Maybe not the best names, but it exposes the instance.

@EladBezalel ideally people who are just using one sidenav would want to just inject MdSidenav and get the instance they care about, but I'm not sure we have any mechanism to do this. Creating a separate service and getting the sidenav by some name/id is about the same as injecting MdSidenavContainer and accessing the start/ end sidenav (which already works).

EladBezalel added a commit to EladBezalel/material2 that referenced this issue Jan 30, 2017
- added `open` and `close` functions that applies to both sidenavs in the container and resolves when both are finished

fixes angular#2591
EladBezalel added a commit to EladBezalel/material2 that referenced this issue Feb 15, 2017
- added `open` and `close` functions that applies to both sidenavs in the container and resolves when both are finished

fixes angular#2591
EladBezalel added a commit to EladBezalel/material2 that referenced this issue Mar 8, 2017
- added `open` and `close` functions that applies to both sidenavs in the container and resolves when both are finished

fixes angular#2591
EladBezalel added a commit to EladBezalel/material2 that referenced this issue Mar 14, 2017
- added `open` and `close` functions that applies to both sidenavs in the container and resolves when both are finished

fixes angular#2591
mmalerba pushed a commit that referenced this issue Apr 25, 2017
- added `open` and `close` functions that applies to both sidenavs in the container and resolves when both are finished

fixes #2591
@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 5, 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 P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants