Issue
I am encounter this erro when trying to click on Home -> toggle menu and navigate to "Profile" .I’ve try multiple approcah yet still same erro .please help me
App-routig.module.ts
import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
const routes: Routes = [
{
path: 'home',
loadChildren: () => import('./home/home.module').then( m => m.HomePageModule)
},
{
path: 'profile/',
loadChildren: () => import('./profile/profile.module').then( m => m.ProfilePageModule)
},
];
@NgModule({
imports: [
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
],
exports: [RouterModule]
})
export class AppRoutingModule { }
app.component.ts
app.component.ts
export class AppComponent {
navigate : any; //new added for toggle menu
this.sideMenu(); //new added for toggle menu
this.initializeApp();
}
}
sideMenu() { //new added for toggle menu
this.navigate =
[
{
title : 'Home',
url : './home',
icon : 'home-outline' ,
//icons : 'home-outline',
},
{
title : 'Profile',
url : './profile',
icon : 'person-circle-outline' ,
},
];
app.module.ts
Solution
Your route path is wrong. Maybe just a typo. Remove the extra forward slash /
for profile path.
{
path: 'profile',
loadChildren: () => import('./profile/profile.module').then( m => m.ProfilePageModule)
},
Answered By – Mir entafaz Ali
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0