angularjs - Confused about ui-router nesting -


i'm trying find way 1 of views have multiple states. let's have template:

<body>   <div ui-view="overlay">   <div ui-view="content"> </body> 

...and these routes:

$stateprovider   .state('base', {     url: '',     abstract: true,      views: {       'overlay': {         templateurl: '/src/overlay.html'       }     }   })   .state('base.page1', {     url: '/page1/',     views: {       'content@': {         templateurl: '/src/page1.html'       }     }   })   .state('base.page2', {     url: '/page2/',     views: {       'content@': {         templateurl: '/src/page2.html',       }     }   }); 

this allows me show "overlay" view on page1 , page2.

the "overlay" view needs able change state without affecting else on page. can set "overlay" parent state , add children it, can't figure out way activate of overlay.child states inside base state without losing whatever in base state. can point me in right direction?

edit: plunker here http://plnkr.co/edit/vpmnhvlzni2foazzohkg

your question not clear, maybe want make them nested?

<div ui-view="parent">     <div ui-view="child">      </div> </div>   $stateprovider     .state('parent', {         url: "/",         views: {             'parent': {                templateurl: '/view/parent.html'             }         }     })     .state('parent.child', {         url: "/",         views: {             'child@parent': {                templateurl: '/view/child.html'             }         }     }) 

or not looking for?

edit:

what this solution

and if want can use variables current state don't have define overlay states parent states in routeprovider shown in this dirty example:

edit2:

what want parallel states. can read here on topic , find out not yet supported in ui-router. written in comment below can take @ ng-switch if don't need state variables, since can create similar parallel behavior directive.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -