I created a new module in my application with my routes and made the necessary inports in my app.modules, but in the browser console there was an error which I could not solve and I also did not find any response for the 5x angle.
The error that gives is:
ERROR Error: StaticInjectorError [ChildrenOutletContexts]: StaticInjectorError [ChildrenOutletContexts]:
My route file is:
import { ModuleWithProviders } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { CursosComponent } from './cursos/cursos.component';
import { LoginComponent } from './login/login.component';
import { HomeComponent } from './home/home.component';
const APP_ROUTES: Routes = [
{ path: 'cursos', component: CursosComponent },
{ path: 'login', component: LoginComponent },
{ path: '', component: HomeComponent }
];
const routing: ModuleWithProviders = RouterModule.forRoot(APP_ROUTES);
And my app.module would be this:
import { BrowserModule } from '@angular/platform-browser';
import { MaterializeModule } from 'angular2-materialize';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { HomeComponent } from './home/home.component';
import { LoginComponent } from './login/login.component';
import { CursosComponent } from './cursos/cursos.component';
import { RouterModule, Routes } from '@angular/router';
@NgModule({
declarations: [
AppComponent,
HomeComponent,
LoginComponent,
CursosComponent
],
imports: [
BrowserModule,
RouterModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
Does anyone have any idea how to solve this?