AngularJs UI路由器在嵌套参数视图

时间:2017-12-25 03:58:38

标签: angularjs angular-ui-router

我有一些UI状态定义如下:

//Parent State
$stateProvider.state(
    'customerdetail', {
    url: '/detail/:customerId',
    templateUrl: 'adminpages/customer.detail',
    controller: 'customerdetail',
    }
);

//Nested state1
$stateProvider.state(
    'customerdetail.detailInfo', {
        url: '/detailInfo',
        templateUrl: 'adminpages/customer.custDetail.detailInfo',
        controller: 'customerDetailInfo',
    }
);
//Nested state2
$stateProvider.state(
    'customerdetail.followRecord', {
        url: '/followRecord',
        templateUrl: 'adminpages/customer.custDetail.followRecord',
        controller: 'followRecord',
    }
);

//Some other state
$stateProvider.state(
    'newfollowrecords', {
        url: '/newfollowrecords',
        templateUrl: 'adminpages/customer.newfollowrecords',
        controller: 'newfollowrecord',
    }
);

当我点击一个将嵌套状态2更改为其他状态然后导航回来(使用浏览器历史记录)的网址时,浏览器会快速闪存到嵌套状态2,然后最终保持嵌套状态。

相同的操作在没有参数的其他嵌套状态上没有这种行为。

所以,我想知道我定义的参数是否有问题。感谢你能给我一些解决方案,非常感谢。

1 个答案:

答案 0 :(得分:0)

我的错误是在父状态控制器中,我程序切换到嵌套的state1