I encountered an error stating "Cannot find name 'Calendar Component'" while attempting to add a route to a component from another module in my app.module.ts file.
Below is the content of my app.module.ts file:
// Importing Modules //
import {BrowserModule} from '@angular/platform-browser';
import {NgModule} from '@angular/core';
import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
import {RouterModule, Routes} from '@angular/router';
import { CalendarModule } from './scripts/calendar/calendar.module';
// Importing Components //
import { AppComponent } from './app.component';
// Declaration of Routes //
@NgModule({
declarations: [
AppComponent
],
imports: [
CalendarModule,
BrowserModule,
NgbModule.forRoot(),
RouterModule.forRoot([
{
path: 'calendar', component: CalendarComponent
}
])
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
and here is the content of my calendar.module.ts file:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { CalendarComponent } from './calendar.component';
@NgModule({
imports: [
CommonModule,
FormsModule
],
declarations: [CalendarComponent],
exports: [CalendarComponent]
})
export class CalendarModule { }
Although I've declared and exported the calendar component in my calendar.Module.ts file (note: calendar.component.ts exists but has been omitted for clarity), my app module seems unable to recognize the component I'm trying to pass in the routes array. Any insights on why this might be happening?
For reference, I am working with Angular v5.2.0