I have the template like this:
<mat-sidenav-container class="sidenav-container">
<my-component></my-component>
...
</mat-sidenav-container>
<my-component> is:
<mat-sidenav #leftSidenav class="sidenav" mode="side" [opened]="true">
...
</mat-sidenav>
When I have my sidenav in two components like this, the mode "side" is not working anymore. The mode switch to "over".
When I have all in the same component, it's working.
I think it's due to a another tag between
Angular Material 5.0.1
This use case is not currently supported, instead you would do something like this:
<mat-sidenav-container>
<mat-sidenav>
<my-sidenav></my-sidenav>
</mat-sidenav>
<mat-sidenav-content>
<my-content></my-content>
</mat-sidenav-content>
</mat-sidenav-container>
I would also love to see this split-up!
Would also love to see all sidenav 'modes' working when splitting out into different components via transclusion/content-projection.
Currently only 'over' works...
Repro on stackblitz: https://stackblitz.com/edit/angular-material-sidenav-mode
Mode is set to 'push' while showing behaviour of 'over' in /app/components/sidenav.component
The sidenav split out approach is also used by the ngrx team in their example app: https://github.com/ngrx/platform/tree/v4.1.1/example-app
You can reproduce the issue in the example-app by trying to set the mode to 'push' or 'side'.
According to official docs: "The
Most helpful comment
This use case is not currently supported, instead you would do something like this: