I very new to angular routing and lazy loading modules.
ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'login-admin/admin-dashboard' Error: Cannot match any routes. URL Segment: 'login-admin/admin-dashboard'
I don' know where I'm getting the error tho.
App Module
@NgModule({
declarations: [
AppComponent,
SignupAdminComponent,
HeadersComponent,
LoginAdminComponent
],
bootstrap: [AppComponent]
App.Routing.ts
const routes: Routes = [
{ path: '', redirectTo: '/login-admin', pathMatch: 'full'},
{ path: 'login-admin', component: LoginAdminComponent},
{ path: 'sigup-admin', component: SignupAdminComponent},
{ path: '',
loadChildren: './components/dashboards/admin-dashboard/admin-routing.module#AdminRoutingModule'
}
];
@NgModule({
declarations: [],
imports: [
CommonModule,
RouterModule.forRoot(routes),
// AdminDashboardModule
]
})
export class AppRoutingModule { }
admin-routing.module.ts
@NgModule({
declarations: [
AdminDashboardComponent,
SideBarComponent,
],
imports: [
CommonModule,
NbLayoutModule,
NbSidebarModule,
NbButtonModule,
RouterModule.forChild(AdminRoutes)
],
exports: [ ]
})
export class AdminRoutingModule { }
admin-routing.ts
import { Routes } from '@angular/router';
import { AdminDashboardComponent } from './admin-dashboard.component';
import { LoginAdminComponent } from '../../accounts/admin/login-admin/login-admin.component';
import { SideBarComponent } from './side-bar/side-bar.component';
import { ExtenstionAgentComponent } from './extenstion-agent/extenstion-agent.component';
export const AdminRoutes: Routes = [
{
path: '', component: AdminDashboardComponent},
{ path: '', redirectTo: 'admin-dashboard', pathMatch: 'full' },
{ path: 'admin-dashboard', component: AdminDashboardComponent },
];