I am currently working on an Angular 6 project. In my app.routes
, I have set it up like this. However, I am facing an issue where I can only access the route using localhost:4200/#/Student
instead of localhost:4200/Student
. Can you help me identify where the mistake might be?
app.routes.ts
export const routes: Routes = [
{ path: '', component: MenuLayoutComponent, data: { title: 'Menu Layout' }, children: MenuLayoutRoutes }
];
export const AppRoutes: ModuleWithProviders = RouterModule.forRoot(routes);
menu-layout.routes.ts
export let MenuLayoutRoutes: Routes = [
{ path: 'Student', component: StudentComponent, canActivate: [RoleGuard] },
{ path: 'University', component: UniversityComponent, canActivate: [RoleGuard] }
];
app.module.ts
imports: [
AppRoutes
]
providers: [
{ provide: LocationStrategy, useClass: HashLocationStrategy },
{ provide: HTTP_INTERCEPTORS, useClass: LoaderInterceptor, multi: true }
],