I've read through the documentation for angularjs-ui-router, a bunch of samples and a bunch of stackoverflow posts but I can't seem to figure out how to do this very specific thing.
The problem is having a set of named views and only wanting to update 1 of them without reloading/resetting the other named views. I've tried some kind of state inheritance between them, but it kind of doesn't make sense since neither should be an ancestor to the other.
Let's say I have a nested unnamed ui-view containing 3 named views, like so:
<div>
<div ui-view="viewA"></div>
<div ui-view="viewB"></div>
<div ui-view="viewC"></div>
<a ui-sref="mystate.stateA">Activate A</a>
<a ui-sref="mystate.stateB">Activate B</a>
<a ui-sref="mystate.stateC">Activate C</a>
</div>
Then, in my state provider, i have the following config:
.state('mystate', {
url: "/mystate",
views : {
"": { templateUrl: "/app/views/myview.html", controller: "myController" },
"viewA": { template: "Nothing" },
"viewB": { template: "Nothing" },
"viewC": { template: "Nothing" }
}
})
.state('mystate.stateA', {
url: "/stateA",
views : {
"viewA": { template: "A" }
}
})
.state('mystate.stateB', {
url: "/stateB",
views : {
"viewB": { template: "B" }
}
})
.state('mystate.stateC', {
url: "/stateC",
views : {
"viewC": { template: "C" }
}
})
Now, when I click on link "Activate A", it shows the string "A" instead of "Nothing" in viewA, so far so good. But when I click on link "Activate B", viewA "resets" to the ancestor state's "Nothing" again while viewB shows "B".
What I am wondering is if it's possible to prevent viewA from resetting to "Nothing" in this scenario?