I'm using the latest Angular CLI build (16) and I'm trying to lazy load routes but it fails for some reason, I can't find any new questions or solutions for this.
Folder structure:
core.component.html:
<router-outlet></router-outlet>
core.component.ts:
import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {RouterModule} from '@angular/router';
// Modules
import {AdminAreaModule} from './+admin-area';
// Services
import {GlobalsService, RegexService, UtilsService} from './shared';
// Main app component
import {CoreComponent} from './core.component';
@NgModule({
imports: [
BrowserModule,
// Feature modules
AdminAreaModule
],
exports: [
BrowserModule
],
declarations: [
CoreComponent
],
providers: [
GlobalsService,
RegexService,
UtilsService
],
bootstrap: [CoreComponent]
})
export class CoreModule {}
admin-area-router.module.ts:
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
// Global modules
import {ComponentsModule, SharedModule} from '../../shared';
// Lazy loaded modules
import {AdminAreaModule} from '../admin-area.module';
@NgModule({
imports: [
RouterModule.forChild([
{
path: 'admin',
loadChildren: 'app/+admin-area/admin-area.module#AdminAreaModule'
}
])
],
exports: [
RouterModule
]
})
export class AdminAreaRouterModule {}
admin-area.module.ts:
import {NgModule} from '@angular/core';
import {AdminAreaRouterModule} from './router';
import {ComponentsModule, SharedModule} from '../shared';
@NgModule({
imports: [
ComponentsModule,
SharedModule,
// Feature modules
AdminAreaRouterModule
],
exports: [
ComponentsModule,
SharedModule,
AdminAreaRouterModule
]
})
export class AdminAreaModule {}
This throws an error:
Error in ./CoreComponent class CoreComponent - inline template:0:0 caused by: No provider for RouterOutletMap!
Why am I getting this error when I clearly have a router-outlet
in my core.component.ts
file?