I need more understanding about route

I’ m developing an app with a main page with a leaflet map. There are a lot of things happening on the map guided by a side menu. This page work fine. There are some side pages to prepare and maintain some data. I put these pages together with a state provider. Switching between the map page and the other pages works fine (except for an error from sidemenu) , but if I switch back to the main page ( the one with map) troubles begin. As far as I understand now the main page is starting over from scratch each time the app returns to this page. The biggest problem is this page has an error and strange behavior after I returned to this map page. I didn’t find a way to manage this right. The only way to get it right is starting the app from scratch loading from the index.hrml page.

Is there a way to keep the map page after leaving for another page? Keep on working after returning?.

If not. What can I do to rebuild the paging working again without restarting the app.

There is a lot code in this app. It’s impossible to make a codepen from this code. First thing I want to know is answers for my questions.

BTW after leaving I get this nasty error about the sidemenu.

I stripped my app to a basic app. Just to show the problem. I created a codepen. But my code did not work. Maybe because I not have experience with codepen. Here is a link to te pen:

See the Pen rBFCw by Piet Crombach (@pcrombach) on CodePen.

Here is the error I was talking about : Error: [$compile:ctreq] Controller ‘ionSideMenus’, required by directive ‘menuToggle’, can’t be found! This happens if I leaf the mainpage ( with leaflet map) to another page. This mainpage has a sidemenu. The other pages dont have a sidemenu.