Angular canActivate外部路由器:[AuthGuard]不';行不通

Angular canActivate外部路由器:[AuthGuard]不';行不通,angular,typescript,nativescript,router,guard,Angular,Typescript,Nativescript,Router,Guard,我的路线有问题 我尝试使用以下代码: const routes: Routes = [ { path: 'home', component: HomeComponent, canActivate: [AuthGuard], children: [ { path: 'events', component: EventsComponent }, { path: 'package', component: PackageComponent }, { pa

我的路线有问题

我尝试使用以下代码:

const routes: Routes = [
  {
    path: 'home', component: HomeComponent, canActivate: [AuthGuard], children: [
      { path: 'events', component: EventsComponent },
      { path: 'package', component: PackageComponent },
      { path: 'settings', component: SettingsComponent }
    ]
  },
  { path: 'login', component: LoginComponent },
  { path: '**', redirectTo: 'home' },
  { path: "register", component: RegisterComponent },
  { path: "usersforgetpassword", component: ResetPassComponent }
];

无法工作导航,忘记了密码(ResetPassComponent)和新帐户(RegisterComponent)

Html代码:

<StackLayout>
        <Label [nsRouterLink]="['/usersforgetpassword']" class="text-center footnote">
            <FormattedString>
                <Span text="Forgot password?  "></Span>
            </FormattedString>
        </Label>
    </StackLayout>
    <StackLayout>
        <Label [nsRouterLink]="['/register']" class="text-center footnote">
            <FormattedString>
                <Span text="New Account "></Span>
            </FormattedString>
        </Label>
    </StackLayout>

请问,我的路由器出了什么问题?我不明白

Thnx

请将这些

{ path: "register", component: RegisterComponent },
  { path: "usersforgetpassword", component: ResetPassComponent }
以前

 { path: '**', redirectTo: 'home' } 

通配符路由应该始终位于末尾,否则下面的路由将无法工作,因为它匹配所有可能的字符串


请参阅:

您是否正在使用
页面路由器插座
?是