每当我导航到/about页面时,我的应用程序就会以一个带有错误Throttling history state changes to prevent the browser from hanging的无限循环结束。
每当我导航到/页面时,我的应用程序就不会导航到dashboard,它只显示一个空白页面。
如果找到令牌,我希望我的页面导航到/dashboard,而在没有找到令牌的情况下,导航到/home或/。
此外,如果找到令牌,我希望下面链接的其余页面无法访问(除了仪表板)。
我怎么才能解决这个问题?
app.routing.component.ts
const routes: Routes
我有一个关于Angular 2路由器使用3.0.0-rc.1版本的小问题,我想根据用户角色导航到不同的主组件,如AdminComponent或UserComponent。有没有人可以帮我修改一下下面的路线,这样我就可以实现想要的功能了?
{path: 'login', component: LoginComponent}, // <--- This redirects to '/' in case user is logged in
{
path: '',
component: HomeComponent,
如果值为false,则不能将受保护的组件HeaderComponent重定向到LoginComponent组件,而是函数canActivate。
HeaderComponent组件及其子组件受到保护,只访问http://localhost:3000/#/header/index屏幕上的http://localhost:3000/#/header/index,我希望它被定向到http://localhost:3000/#/auth,即登录屏幕
有人知道怎么帮我吗?
auth.guard.ts
import {Injectable} from '@angular/core';
im