我的路由有问题。
我尝试使用此代码:
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
答案 0 :(得分:1)
请放置这些
{ path: "register", component: RegisterComponent },
{ path: "usersforgetpassword", component: ResetPassComponent }
之前
{ path: '**', redirectTo: 'home' }
答案 1 :(得分:0)
通配符路由应始终位于末尾,否则低于该通配符的路由将不起作用,因为它匹配所有可能的字符串。