How to get javascript to work well with router?


I’m trying to implement a sidebar (leveraging the sidebar from sb-admin-2

When I use the side bar as part of main.html, the toggles work perfectly fine. However, when I implement the same via iron:router and set the sidebar to be persistant, the sidebar loses the toggle/hide functionality. basically, the child level elements are always expanded and I have no means to hide those child level elements. Is there a work around to this?

I’ve the side bar code here in pastie --> This works when in client/main.html

But when I try the same from within a template such as this and pass it to iron:router via the below code, the toggle functionality is lost


      layoutTemplate: 'sidebar'