0
后,我有一个路线:
$stateProvider.state('keeper.telepay.category', {
url: '/category-{id}/country-{cid}/region-{rid}'
}
在所有情况下,当我使用$这个路线state.go,我想摆脱更改为“所有”如果它的值是 '0',所以我url'll像
/1类/国家-195 /地区所有
我试图做到这一点在$ rootScope。$上('$ stateChangeStart'),但没有运气。任何建议||方向将非常感激。
UPDATE
这里我已经试过在$ stateChange:
$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams){
if(toState.name == 'keeper.telepay.category' && toState.params.rid == 0) {
toState.params.rid = 'all';
}
}
应该在'$ rootScope。$ on('$ stateChangeStart')'中发布你已经尝试过的东西,因为这就是人们会提出的建议。 – KreepN
也许你可以用[$ urlMatchFactory](http://angular-ui.github.io/ui-router/site/#/api/ui.router.util.$urlMatcherFactory)开始试用以创建你自己的参数类型。 – MMhunter
好的建议,thx – Kindzoku