我想实现使用stateProvider嵌套状态。在使用url-routing加载嵌套状态时面临问题。我为独立国家之一创建了两个独立状态和两个嵌套状态。请检查下面的状态配置:AngularJS嵌套状态使用stateProvider
.state('state1',{
url : "/page1",
templateUrl : "/views/page1.html",
contoller : 'page1ctrl'
})
.state('state2', {
url : "/page2",
templateUrl : "/views/page2.html",
controller : 'page2ctrl'
})
state('state2.nestedstate1', {
url : "/:nestedstate1", //passing as parameter
templateUrl : "/views/temp1.html",
controller : 'page2ctrl'
})
.state('state2.nestedstate1.nestedstate2', {
url : "/nestedstate2/:param1/:param2",
templateUrl : "/views/temp2.html",
controller : 'ctrl'
})
问题:如果我尝试加载整个页面直接使用完整的URL index.html/page2/nestedstate1/nestedstate2/fname/lname
,它将从最后一个子状态第一次加载数据nestedstate2然后回落到其父状态“ nestedstate1'并且还将URL更新为index.html/page2/nestedstate1
。
需要的行为是首先执行父状态,然后是子状态。例如,在nestedstate2之前加载nestedstate1是必要的。
请建议我是否缺少任何配置。
谢谢
一定要产生plnkr或小提琴为了这。 UI路由器相当复杂。 – 2015-02-24 11:25:04
我将很快发布一个plnkr。在它上面工作。 – 2015-02-24 11:34:20
同时,如果有人面临同样的问题。请给出意见。 – 2015-02-24 11:38:30