4
我正在轉移到UI-Router
作爲我的應用程序路由器。我想下面以嵌套狀態:UI-Router:防止訪問父狀態
$stateProvider
.state('app', {
url: '/app',
template: ' <div ui-view></div>',
authenticate: true
})
.state('app.state1', {
url: '/state1',
templateUrl: 'app/state1.html',
controller: 'State1Ctrl',
controllerAs: 'state1',
authenticate: true
})
.state('app.state2', {
url: '/state2',
templateUrl: 'app/state2.html',
controller: 'State2Ctrl',
authenticate: true
})
我$state
稱爲app
是別人的父母。它只包含一個<div ui-view></div>
模板。它不應該直接訪問。我的意思是如果用戶在URL中輸入/app
,他們應該被重定向到`app.state1``
如何防止我的用戶這樣做?
感謝你爲這個明確的答案。它完美的作品。 –
太棒了!享受強大的UI-Router;) –