我已经在 app-routing.module.ts 中设置了
{path: 'profile:/userId', component: ProfileComponent, canActivate:[AuthGuard]},
// In case the address doesn't match our paths ,redirects to login
{path: '**', redirectTo: 'login'}
任何未知的路径词都会将我重定向到登录页面,但是当我单击导航栏按钮上的配置文件时也会发生这种情况。
而不是进入 profile.componennt.html 视图,而是登录。知道为什么会这样吗?
<a [routerLink]="'/profile/' + currentUser.id" class="nav-link">Profile</a>