material icon indicating copy to clipboard operation
material copied to clipboard

Sidenav doesn't show on partial view

Open ghost opened this issue 12 years ago • 7 comments

When I change view (ng-view) using partials, the sidenav inside my partial view doesn't get toggled (both 'on' and 'off' won't work) unless I reload the whole page.

Any idea?

Code is pretty simple: got a sidenav in the main layout (which currently has no issues) and various (depends on the partial, between 1 and 2) other sidenavs which need a click on a button (with a call on a $scope function) to get toggled.

ghost avatar Oct 24 '14 10:10 ghost

Can you open a plunkr with a reproduce case?

ajoslin avatar Oct 28 '14 17:10 ajoslin

Aye, here it is:

http://plnkr.co/F2q4nCgloqnIX7gJjkTL

You might need to wait some seconds to see the full view due to heavy scripts inclusions (angular-animate, angulat-route, etc.)

ghost avatar Oct 29 '14 10:10 ghost

+1 for this issue. Seems that $mdComponentRegistry doesn't check for duplicates on register step. And it returns wrong instance of sidenav when partial view loads again.

crrazymind avatar Oct 30 '14 17:10 crrazymind

Good catch @crrrazymind.

The component registry is very old, and was only meant to be a proof of concept. It will be refactored soon.

For now, I would advise using data-binding to open and close your sidenav.

ajoslin avatar Oct 30 '14 22:10 ajoslin

Nice to know what it's about.

@ajoslin What do you mean by "data-binding" to open and close the sidenav?

ghost avatar Oct 31 '14 15:10 ghost

Use the is-open attribute. It's in the API documentation for sidenav.

ajoslin avatar Oct 31 '14 16:10 ajoslin

Thank you for explanation, your suggestion works perfectly.

ghost avatar Nov 03 '14 12:11 ghost