Angularjs 刷新时,角度页面自动重定向到父状态
每当我刷新页面时,它都会进入父状态。我已经给出了我的代码片段Angularjs 刷新时,角度页面自动重定向到父状态,angularjs,angular-ui-router,route-provider,Angularjs,Angular Ui Router,Route Provider,每当我刷新页面时,它都会进入父状态。我已经给出了我的代码片段 $urlRouterProvider.otherwise('/'); $stateProvider .state('home', { url:'/', templateUrl: 'modules/home/home.html', }).state('home.addcrew', { url: '/addcrew', templateUrl: 'modules/cr
$urlRouterProvider.otherwise('/');
$stateProvider
.state('home', {
url:'/',
templateUrl: 'modules/home/home.html',
}).state('home.addcrew', {
url: '/addcrew',
templateUrl: 'modules/crew/addCrew.html',
})
如何在刷新时保留我的当前页面?谁能帮我一下吗?有一个电话
我们需要的是,告诉UI路由器关于孩子的特殊url。它是特殊的,因为父项包含“/”
,子项包含“/addcrew”
将以//addcrew
结束
但我们希望子级重新启动url(不使用父级部分)-我们可以使用^
符号:
$stateProvider
.state('home', {
url:'/',
...
}).state('home.addcrew', {
url: '^/addcrew',
...
})
在这里查看它的运行情况
$urlRouterProvider.others()之前检查条件。
编写$urlRouterProvider.others('/')代码>在末尾。您不允许从$stateProvider
@MaximShoustin检查状态,它在浏览器中显示刷新时的基本url。@AgamBanga我尝试过。但得到了相同的结果