发现一个头疼的问题,虽然没有发现原因,但是知道如何解决
const routes: Routes = [
{ path: "", component: HomeComponent, canActivate: [AuthGuard], data: { title: "Home" } },
{ path: "login", component: LoginComponent, data: { title: "Login" } },
{ path: "employee", component: EmployeeComponent, canActivate: [AuthGuard], data: { title: "Employee" } },
{ path: "account", component: AccountComponent, canActivate:[AuthGuard],data: { title: "Account" } },
{ path: "dresscode", component: DresscodeComponent, canActivate:[AuthGuard],data: { title: "DressCode" } },
{ path: "guesttype", component: GuesttypeComponent, canActivate:[AuthGuard],data: { title: "GuestType" } },
{ path: "sendemail", component: SendemailComponent, canActivate:[AuthGuard],data: { title: "SendEamil" } },
{ path: "cyclecategory", component: CyclecategoryComponent, canActivate:[AuthGuard],data: { title: "CycleCategory" } },
{ path: "about", component: AboutComponent, data: { title: "About Us" } },
{ path: "home", redirectTo: "/", pathMatch: "full" },
{ path: "**", component: NotFoundComponent, data: { title: "Page Not Found" } },
{ path: "cyclecategory", component: CyclecategoryComponent, canActivate:[AuthGuard],data: { title: "CycleCategory" } },
如上定义的路由,链接cyclecategory就会报错404,只需要把定义的此行信息移动到 page not found上面的任意位置就可以正常链接了,是不是很奇怪,不知道是不是因为有链接先后索引顺序的原因,希望有大佬可以解释原因。
因篇幅问题不能全部显示,请点此查看更多更全内容