Domanda

For example, I have a background template view rendered with backbone view when user visits the index route. Then every event is handled by backbone and the template does persist thoughout the routes. However, when I use refresh or backbutton in other routes different than index. my template view disappears. Is there a way to have make background template view persist under any routes against refresh and back button

Edit: I use the routes:

'index' : 'render_bg_template'  

to initialize and render the view. So I am looking for a method to have it rendered after refresh in any routes

È stato utile?

Soluzione

you could listen to the router 'route' event that gets triggered every time a route has occurred.

router.on("route", function(){
   //render template here
});

Docs: "route:[name]" (params) — Fired by the router when a specific route is matched.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top