如果不将pathMatch填满就无法访问页面,它总是重定向到pathmatch

时间:2019-05-16 09:02:19

标签: angular redirect path routing

问题是当我继续localhost:4200/register时,它会将我重定向到localhost:4200/auth

当我将路径匹配完全放在寄存器中时,我可以访问该页面。但是如果没有路径匹配,我无法访问,它将我重定向到auth

//auth is the authentification page, it has the pathMatch full
{ 
    path: '',
    redirectTo: '/auth',
    pathMatch: 'full'
},

{
   path: 'auth',
   component:AuthComponent
},

//register has no pathmatch
{ 
   path: 'register',
   redirectTo: '/register',
},
{
  path: 'register',
  component:RegisterComponent
},

0 个答案:

没有答案