material icon indicating copy to clipboard operation
material copied to clipboard

virtual-repeat: not rendering in md-sidenav

Open apils opened this issue 10 years ago • 6 comments

The virtual-repeat shows when the sidenav is initially rendered open, but if the sidenav is initially rendered closed, and opened programatically then the virtual-repeat does not not render.

apils avatar Feb 26 '16 18:02 apils

A workaround is to call $(window).trigger('resize') after the first call to $mdSidenav('component-id').toggle()

apils avatar Feb 26 '16 19:02 apils

Can reproduce that issue. I've created a little codepen which demonstrates the issue

  • http://codepen.io/DevVersion/pen/jqObZa

devversion avatar Feb 26 '16 20:02 devversion

@topherfangio Since our sidenav is hidden, since the directive compilation, the virtual repeater has no time to validate the layout. That's why we need to trigger a revalidation of the virtualRepeater's layout, when the sidenav is visible to the DOM.

I suggest, calling the resize handler, when the sidenav is opening. That will fix issues with components, which are watching the layout.

angular.element(window).triggerHandler('resize');

Thoughts?

devversion avatar Mar 26 '16 17:03 devversion

For sidenav, this may be acceptable since it shouldn't happen very often, and there is generally only 1-2 sidenav's per app. But I think we need a more generic solution for other components that may depend on the visibility/size of other components. I have a $mdResize service in the works that needs a bit more work here: https://github.com/profoundry-us/material/tree/fix-show-hide-protractor-performance-7159

topherfangio avatar Apr 04 '16 20:04 topherfangio

Still broken per your June 18th comment above; I will implement an async callback, build the model and template dynamically, then inject into side <md-sidenav>'s <md-content> directive, and then post the example for this semi "fixed" framework work around. Hang tight, answer is on the way...

daddydrac avatar Dec 13 '18 13:12 daddydrac

@joehoeller if you are still seeing a bug related to this, please open a new issue with a CodePen reproduction and link to this issue as a reference.

Splaktar avatar Dec 14 '18 21:12 Splaktar