I go out on a limb and assume that the OP question is based on the behavior of the application when navigating various parts of the application through an anchor mark in navigation or something similar.
This is how I found this question, and I briefly thought that the answers would save my day. Although both answers are still correct, they do not completely solve the problem I am facing. I wanted to show a constant navigation bar. However, I did not want it to appear on the login page. I was hoping that by discovering that the region was already shown or not, I could correctly let the display logic take care of this.
As it turned out, we were on the right track for the implementation of the regions, since it provides granular control, but even after implementing the above, I found that my navigation bar is still โflickeringโ and essentially completely reboots.
The answer is actually a bit ridiculous. Somehow in all the Backbone tutorials and studies that I have been doing the last two weeks, I have not had to deal with the need to implement a javascript interface to interrupt the behavior of a regular link. Whenever a navigation item was clicked, the entire application rebooted. Routing functioned, so the contents were correct, but the flicker was crazy.
I added the following to the app.js file right after Backbone.history.start ({pushState: true}); code:
// Holy crap this is SOOO important! $(document).on("click", "a[href^='/']", function(event) { if (!event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey) { event.preventDefault(); var url = $(event.currentTarget).attr("href").replace(/^\//, ""); Backbone.history.navigate(url, { trigger: true }); } });
Check out this article for some explanation of keyPress stuff. http://dev.tenfarms.com/posts/proper-link-handling
Boom! After adding this material to my application, it no longer completely reboots!
Disclaimer: I am very new to Backbone, and the fact that the above was such a revelation to me makes me think that I can do something wrong elsewhere, and this behavior should already exist in Backbone. If I made a giant mistake here, please comment and help me fix it.