iT邦幫忙

0

angular router redirectTo 預設 params

假設有人進了空網址進來,希望把它導向某個params,但只能寫死像這樣

{ path: '', redirectTo: '/defaultparams'}, //寫死成/params導向/params
{ path: '/defaultparams', component: acomponent }
{ path: ':params', component: acomponent }

:params有辦法為空的時候給他一個值嗎,還是只能寫在component裡面去判斷

{ path: '', redirectTo: ':params'},
{ path: ':params', component: acomponent }

尚未有邦友回答

立即登入回答