You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use a ngIf binding to remove my sidenav from my login page, but after updating to 2.0.0-beta.10 from 2.0.0-beta.8, if I navigate to the login page from one in which the menu was open, the page content stays with a 300px left margin (the width of my sidenav).
What is the expected behavior?
The sidenav container should get margin-left: 0px after the sidenav is no more displayed, like when it's closed using sidenav.close().
What is the current behavior?
I filter the navigation events and use them to determine if the current page is the login page or not to remove the sidenav, it worked fine on 2.0.0-beta.8:
// This function is called on my ngOnInit(), in my app.component.ts
setupMenu() {
// Filter the NavigationEnd events from the router
this.router.events.filter((event) => event instanceof NavigationEnd)
.map(() => this.activatedRoute)
.map((route) => {
while (route.firstChild) route = route.firstChild;
return route;
})
.filter((route) => route.outlet === 'primary')
.mergeMap((route) => route.data)
.subscribe((event) => {
// This variable is the one used on the ngIf binding to show the menu
this.showMenu = this.shouldShowMenu();
});
}
/**
* Returns whether the current page should have the sidenav or not
*/
shouldShowMenu(): boolean {
return !((this.router.url == "/") || (this.router.url == "/login"));
}
Removing the sidenav via ngIf binding, the sidenav-containermargin-left will continue the width of the sidenav.
Is it possible that this bug is happening because the sidenav has been split into MdSidenav and MdDrawer?
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
The text was updated successfully, but these errors were encountered:
faelmorais
changed the title
Sidenav content, margin-left staying when after removing the sidenav from the page
Sidenav content margin-left staying after removing the sidenav from the page
Sep 13, 2017
Bug:
I use a
ngIf
binding to remove mysidenav
from my login page, but after updating to2.0.0-beta.10
from2.0.0-beta.8
, if I navigate to the login page from one in which the menu was open, the page content stays with a 300px left margin (the width of my sidenav).What is the expected behavior?
The sidenav container should get margin-left: 0px after the sidenav is no more displayed, like when it's closed using
sidenav.close()
.What is the current behavior?
I filter the navigation events and use them to determine if the current page is the login page or not to remove the sidenav, it worked fine on
2.0.0-beta.8
:This is a snippet from my sidenav:
What are the steps to reproduce?
Removing the sidenav via
ngIf
binding, thesidenav-container
margin-left
will continue the width of the sidenav.Is it possible that this bug is happening because the sidenav has been split into MdSidenav and MdDrawer?
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
@angular/cli: 1.2.7
node: 6.11.2
os: darwin x64
@angular/animations: 4.3.6
@angular/cdk: 2.0.0-beta.10
@angular/common: 4.3.6
@angular/compiler: 4.3.6
@angular/compiler-cli: 4.3.6
@angular/core: 4.3.6
@angular/flex-layout: 2.0.0-rc.1
@angular/forms: 4.3.6
@angular/http: 4.3.6
@angular/language-service: 4.3.6
@angular/material: 2.0.0-beta.10
@angular/platform-browser: 4.3.6
@angular/platform-browser-dynamic: 4.3.6
@angular/router: 4.3.6
@angular/cli: 1.2.7
Chrome 60.0.3112.113 and Firefox 55.0.3
The text was updated successfully, but these errors were encountered: