I feel like this is a straight forward use case for the ui-router
but maybe I'm missing something...
I want to have two separate views next to each other controlled by their own menus. When I click a ui-sref
link on one menu (or $state.go
for that matter), I would like to update only one of the views. Additionally, only one of the two views needs to be reflected in the url
.
I tried defining a few states:
$stateProvider
.state('home', {
url: '/',
views: {
'viewA': {
template: "I'm number A!"
},
'viewB': {
template: "It's good to be B."
}
}
})
.state('shouldOnlyChangeA', {
'url': '',
views: {
'viewA': {
template: 'Check out my new shoes!'
}
}
})
.state('shouldOnlyChangeB', {
'url': '/shouldGoToNewUrl',
views: {
'viewB': {
template: "This probably won't work..."
}
}
});
Now press $state.go('shouldOnlyChangeA')
from your favorite controller and watch it change the crap out of viewB
. I'd also like to omit the url
definition in this state since the url
should only change between the first and third states I've defined.
I have each ui-view
sitting next to each other in index.html:
...
<div ui-view="viewA"></div>
<div ui-view="viewB"></div>
...
TL;DR
I want two sibling ui-view
s to be stateful all on their own; changing one shouldn't necessarily effect the other.
Hopefully I'm just missing something so I didn't bother to throw a plunker together or anything, but if it's more complicated and folks are willing to fiddle I'll whip something up.