我有UI的路由器的配置如下圖所示:角UI路由器動態PARAMS雙斜線
.state('xxx.components',{
url: '/:runId/component',
reloadOnSearch: false,
templateUrl: '/modules/xxx//views/cloud-components/templates/cloud-components.tpl.html',
controller: 'CloudComponentsCtrl',
controllerAs: 'ctrl'
})
,如果我去到組件頁面沒有任何runid,請在網址看起來象下面這樣:
http://localhost:3031/xxx/run-topologies//component
它將在url中包含雙斜槓,我希望它只包含一個像下面的斜槓,我應該怎麼做才能解決這個問題?
期望的行爲:
使用runid:(這是正確的,由於當前的配置)
http://localhost:3031/xxx/run-topologies/6/component
沒有runid爲:(應該只有1個斜線)
http://localhost:3031/xxx/run-topologies/component
當沒有身份證時SPA會有不同的行爲嗎?如果是這樣,你應該使用Lizzie建議的兩種不同的狀態。 –