Angular UI Router - How to preserve views while switching views

angular-ui, angular-ui-router, angularjs

Solution

I wanted similar functionality too, but ui-router doesn't yet support it. I forked ui-router to support "parallel states" and submitted it to the project for comment. The gist of the conversation is that ui-router will eventually support some form of parallel states but not yet. In the meantime, you can try my fork of 0.2.10 which provides the parallel states that you want.

Read the conversation here: https://github.com/angular-ui/ui-router/issues/894

View the sample parallel tabs plunk here: http://plnkr.co/edit/YhQyPV?p=preview

Here is the fork; build it with grunt: https://github.com/christopherthielen/ui-router

Problem

I am I new to Angular and UI Router. Plunk http://plnkr.co/edit/1wfyrGryfGG5RtXozPFY?p=preview Setup I have three top level application nav buttons Home, Projects, Help. They load different views home.html, projects.html and help.html using the Angular UI Router ui-view directive. This works good. The Projects.html view has a tab bar with each tab corresponding to a project: D1, D2 D3 etc., I show the corresponding project tab using url router attributes. Every time I click the Projects button it is reloading the tab bar completely. I loswe the current tab and hopefully if any nested views inside it. Basically the page contents of Project.html, invoking the controller as well. I read through the wiki documents and couldnt figure out how to implement my required functionality. I am sure I am missing something. Will it always reload the view? Question: How to avoid reloading the projects view contents so that I can retain the selected tab and all the contents as-is before switching to Home. Because I would have a lot of nested views and models on each project.

Original source

Related problems