Iām trying to split an Angular 5 app into modules. The working code is this (the relevant code):
app.module.ts:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FooterComponent } from './path/to/component';
@NgModule({
declarations: [AppComponent, FooterComponent],
imports: [BrowserModule],
bootstrap: [AppComponent]
})
export class AppModule { }
app.component.html:
<app-footer></app-footer>
Now I want to use the footer to change it into a module (just the changes):
app.module.ts:
import { FooterModule } from './path/to/module';
@NgModule({
declarations: [AppComponent, FooterModule],
imports: [BrowserModule],
bootstrap: [AppComponent]
})
export class AppModule { }
footer.module.ts:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule} from '@angular/router';
import { FooterComponent } from './footer.component';
@NgModule({
declarations: [FooterComponent],
imports: [
CommonModule,
RouterModule.forChild([
{ path: 'footer', component: FooterComponent }
])
]
})
export class FooterModule { }
This code doesn't work and I don't know what is wrong. Can you help me with a hint ? Thanks in advance.