I am trying to route to a component:
Here is my route configuration:
const routes: Routes = [
{
path: 'apply', //name of the route
component: Application //component to load when route is hit
}
];
In my App Module:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule,ViewContainerRef } from '@angular/core';
import { FormsModule} from '@angular/forms';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { SidebarComponent } from './sidebar/sidebar.component';
import { ApplyFormComponent } from './apply-form/apply-form.component';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {MdInputModule,MdSelectModule,MdButtonModule} from '@angular/material';
@NgModule({
declarations: [
AppComponent,
SidebarComponent,
ApplyFormComponent],
schemas: [NgModule],
imports: [
BrowserModule,
BrowserAnimationsModule,
AppRoutingModule,
FormsModule,
MdInputModule,
MdSelectModule,
MdButtonModule
],
exports: [MdInputModule,MdSelectModule,MdButtonModule],
providers: [],
bootstrap: [AppComponent],
entryComponents: [ApplyFormComponent]
})
export class AppModule { }
The component I am using is ApplyFormComponent. It simply displays the text: "Hello world."
When I try to change the route link to /apply, I encounter an error:
ERROR Error: Uncaught (in promise): Error: No component factory found for Application. Did you add it to @NgModule.entryComponents? Error: No component factory found for Application. Did you add it to @NgModule.entryComponents?
I have tried searching extensively but haven't found a solution yet. Everything seems to be set up correctly...
Cheers!