0
假设我在Angular 2中有一个AuthGuard,用于检查我是否登录。如果我没有登录,我会重定向到/登录。重定向逻辑位于AuthGuard中。有没有在Angular路由中替换CanNotActivate的好方法?
path: '',
component: HomeComponent,
canActivate: [AuthGuard]
但是如果我已经登录,并尝试去/登录页面。如果用户已经登录并尝试访问/登录页面,那么重定向到主页的最佳方式是什么?路由器上没有canNotActivate。我应该做两个AuthGuards吗?一个叫做AuthGuardNegate的东西?
有没有很好的方法呢?