0
我有我的狀態設置定義如下空:
$stateProvider
.state('parentState', {
abstract: true,
url: '/:tenantId/',
param: {
tenantId: {
array: false
}
},
views: {
'[email protected]': {
templateUrl: 'home/header.html',
controller: 'Header as vm'
},
'[email protected]': {
templateUrl: 'home/footer.html',
controller: 'FooterCtrl as vm'
}
},
resolve: userResolve,
data: {
private: true
}
})
//...4-5 other child states, then a state to handle unknown urls
.state('parentState.otherwise', {
views: {
'@': {
templateUrl: 'home/404/pageNotFound.html',
controller: 'PageNotFoundCtrl as vm'
}
}
});
$urlRouterProvider.otherwise(function ($injector) {
$injector.get('$state').go('parentState.otherwise', {}, {
location: false
});
});
現在,輸入無效的URL時,parentState.otherwise
狀態正確加載,並parentState
PARAM,即tenantId ,也正確填寫。 然而,在頁面重載(刷新,按Ctrl + R)具有相同的無效的URL,parentState.otherwise
狀態負荷,但問題是parentState
PARAM,即tenantId即將爲空字符串(「」)。
注:'PARAM:'應該是'PARAMS:' –
嘗試過,但沒」不改變任何事情。行爲是一樣的。 – Avinash