components icon indicating copy to clipboard operation
components copied to clipboard

feat(sidenav): allow sidenav to be placed in a separate component

Open gtranter opened this issue 8 years ago • 9 comments

Bug, feature request, or proposal:

Bug?

What is the expected behavior?

Right sidenav in over mode shows backdrop when open

What is the current behavior?

Backdrop is not shown. DOM structure is incorrect - mat-sidenav is inside mat-sidenav-content.

What are the steps to reproduce?

https://stackblitz.com/edit/angular-fxp7dt

A custom component that has mat-sidenav-container, mat-sidenav (start/left), plus ng-content slots for the main content, left sidenav content, and another mat-sidenav.

The right side nav drawer opens and closes but the backdrop isn't drawn, and therefore the click-out close behavior is missing. DOM structure is messed up - the second sidenav is placed inside mat-sidenav-content.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

v5

gtranter avatar Jan 17 '18 15:01 gtranter

The sidenav currently doesn't support this style of usage, instead of putting the mat-sidenav in a separate component you can do something like this:

<mat-sidenav-container>
  <mat-sidenav side="end">
    <ng-content select="my-sidenav-content"></ng-content>
  </mat-sidenav>
  <ng-content select="my-main-content"></ng-content>
</mat-sidenav-container>

mmalerba avatar Jan 17 '18 17:01 mmalerba

Any idea when this issue will be fix?

adrianlemess avatar Apr 14 '18 01:04 adrianlemess

A number of components have open issues similar to this. It's something that Angular itself should ideally have better support for. Until then we probably won't implement it because it would make the components more complex and difficult to maintain.

mmalerba avatar Apr 14 '18 04:04 mmalerba

yeah i have been banging my head with this kept thinking I have done something wrong.

joyanta avatar May 20 '18 14:05 joyanta

Please look into supporting this.

aribrick avatar Dec 05 '18 22:12 aribrick

Also suffered with this problem. Tried to put the mat-sidenav into a separate component however it prevented the sidenav from rendering.

jamesbarrett95 avatar Feb 06 '19 13:02 jamesbarrett95

the side navbar is working but the shadow part is not..? I am using side nave in a common component and using the event emitter for parent-child interaction

vijaysirra avatar Jul 04 '19 09:07 vijaysirra

This is a limitation of Angular's content projection. https://github.com/angular/angular/issues/37319 has been filed to hopefully improve some of the short-comings

mmalerba avatar May 28 '20 16:05 mmalerba

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.