import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { LoginComponent } from './pages/login/login.component'; import { RegisterComponent } from './pages/register/register.component'; import { NavigationComponent } from './navigation/navigation.component'; //路由守卫 import { AuthGuard } from './auth.guard' import { HomeComponent } from './pages/home/home.component'; const routes: Routes = [ { path: '', redirectTo: 'login', pathMatch: 'full' }, { path: 'login', component: LoginComponent }, //登录页 { path: 'register', component: RegisterComponent }, //注册页 { path: '', component: HomeComponent, children: [ { path: 'home', loadChildren: () => import('./pages/pages.module').then(m => m.PagesModule) } ] } //首页 ]; @NgModule({ imports: [RouterModule.forRoot(routes)], exports: [RouterModule] }) export class AppRoutingModule { }