I'm building simple angular application. There are two modules as student and teacher. Here is how my project organized.
First when user enter to the application i let him to choose whether he is an teacher or student.
Depending on what he user will be redirected in to the corresponding module.
import {NgModule} from '@angular/core';
import {Routes, RouterModule} from '@angular/router';
import { StudentModule } from './student/student.module';
import { TeacherModule } from './teacher/teacher.module';
import { HomeComponent } from './home/home.component';
const routes: Routes = [
{
path: '',
component: HomeComponent
},
{
path: 'student',
loadChildren: () => StudentModule
},
{
path: 'teacher',
loadChildren: () => TeacherModule
}
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule {
}
Here is my app.routing.ts
file.
My problem us when i redirected into the module i want to route between component in those module. Should i add another <router-outlet>
into each modules or can i do that with the only <router-outlet>
in AppModule
.
If i should add another <router-outlet>
how should i write my router class for those modules.