问题
Say I've got two or more views on the same page that could be seen as widgets - whose state transitions are largely self-contained - what's the best way to implement this kind of "multiple simultaneous states"?
(Or please correct me if this is not what "multiple simultaneous states" means)
回答1:
what exactly you are trying to achieve is not very clear but this might help. Multiple-Named-Views
OR
you can also manage states like:
$stateProvider.state("a", {
url: "/a",
title: "PartA",
templateUrl: "partA.html",
controller: "aCtrl"
}).state("a.list", {
url: "/list/:id",
title: "PartA-List",
views: {
"list": {
templateUrl: "partA.list.html"
}
}
}).state("a.list.detail", {
url: "/detail/:rowId",
title: "PartA-Detail",
views: {
"detail": {
templateUrl: "partA.detail.html"
}
}
});
a.html
<div ui-view="list"></div>
partA.list.html
<div ui-view="detail"></div>
回答2:
Not currently possible with ui-router.
However the topic has been breached in various incarnations.
- https://github.com/angular-ui/ui-router/issues/95
- https://github.com/angular-ui/ui-router/issues/160
来源:https://stackoverflow.com/questions/18094708/angularui-router-whats-the-best-way-to-implement-multiple-simultaneous-state