AngularUI Router - What's the best way to implement “multiple simultaneous states”?

ε祈祈猫儿з 提交于 2020-01-05 05:52:26

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!