我正在尝试通过输入以下路由invite-user
从浏览器URL
访问我的localhost:4200/invite-user
路由,但是应用程序将我重定向到登录页面
import { NgModule } from "@angular/core";
import { Routes, RouterModule } from "@angular/router";
import { LoginComponent } from "src/app/components/login/login.component";
import { RegisterComponent } from "src/app/components/register/register.component";
import { InviteUserComponent } from "src/app/components/invite-user/invite-user.component";
const routes: Routes = [
{ path: "login", component: LoginComponent },
{ path: "register-user", component: RegisterComponent },
{ path: "invite-user", component: InviteUserComponent },
{ path: "", redirectTo: '/login', pathMatch: 'full' }
];
@NgModule({
declarations: [],
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AuthRoutingModule {}
答案 0 :(得分:0)
像这样更改订单
const routes: Routes = [
{ path: "", redirectTo: '/login', pathMatch: 'full' },
{ path: "login", component: LoginComponent },
{ path: "register-user", component: RegisterComponent },
{ path: "invite-user", component: InviteUserComponent }
];