I want to make lazy loaded module in which i have 3 components. The main is Auth component(and signIn and signOut component). So i make the lazy loading and i load my module lazily, but i cant define router-outlet tag in my auth component to make child routes work.
import {NgModule} from '@angular/core';
import {Routes, RouterModule} from '@angular/router';
import {AuthorizationModule} from './authorization/authorization.module';
const routes: Routes = [
{path: 'auth', loadChildren: () => AuthorizationModule}
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule {
}
import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
import {SignUpComponent} from './sign-up/sign-up.component';
import {SignInComponent} from './sign-in/sign-in.component';
import {AuthComponent} from './auth/auth.component';
const routes: Routes = [
{
path: '', component: AuthComponent, children: [
{path: 'signIn', component: SignInComponent},
{path: 'signUp', component: SignUpComponent}
]
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class AuthRoutingModule {
}