md-sidenav: make it automatically responsive
See original GitHub issueFeature request Version: Angular Material 2.0.0-alpha.7 wax-umpire
I’d like to have an option where the sidenav can be responsive automatically, by having a breakpoint where the sidenav is shown by default when the width is higher than X.
This was already implemented in Angular Material (1) as the md-is-locked-open
: https://material.angularjs.org/latest/api/directive/mdSidenav
Is there any plan to have this? I could submit a PR if this is wanted.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:17
- Comments:12 (2 by maintainers)
Top Results From Across the Web
Angular Material: a responsive Sidenav | by Frederic Lopes
In this story, I am going to explain how to create a responsive sidenav using the ... <md-sidenav #sidenav [opened]="screenWidth > 840" ...
Read more >Angular Material SideNav autosize not working - Stack Overflow
1. sidenav.opened unable to work but I use [style. · Use sidenav.toggle() on click of button that regulates sidenav . · the [style.left]...
Read more >Sidenav - Angular Material
Creating a responsive layout for mobile & desktop. A sidenav often needs to behave differently on a mobile vs a desktop display. On...
Read more >Angular Material: Adaptive Layouts - Egghead.io
Combine responsive functionality with media query support and your web ... And we will see how the $mdSideNav service can be used to ......
Read more >Layout Containers - AngularJS Material
Layouts and Responsive Breakpoints ... To make your layout automatically change depending upon the device screen size, use one to the following layout...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Here are 2 ways to make mdsidenav responsive automatically.
In your component,
In your component, add a responsive handler for link click:
The onLinkClick() handler needs to added to each of the menu links in your template.
It will close the menu after clicking a link, but not when the menu should stay open.
In your template, bind the md-sidenav’s “mode”, “opened”, and “disableClose” attributes to your component’s responsive boolean.
Now, based on your responsive breakpoint…
This seems to work too:
Another idea
HTML