title: NullInjectorError: No provider for ChildrenOutletContexts
body: <p>I'm still learning angular. I was trying to create an example on stackblitz to ask another question and ran into an issue with routing.</p>
  
  <p>I'm trying to set up routing. I have added the following to app.module.ts:</p>
  
  <pre><code>  imports:      [ BrowserModule,
                    FormsModule,
                    RouterModule,
  </code></pre>
  
  <p>and then I created app-routing.module.ts:</p>
  
  <pre><code>import { NgModule } from '@angular/core';
  import { RouterModule, Routes } from '@angular/router';
  
  import { NavComponent } from './components/NavComponent';
  import { SearchComponent } from './components/SearchComponent';
  import { ViewComponent } from './components/ViewComponent';
  
  const routes: Routes = [
    { path: '', redirectTo: '/nav', pathMatch: 'full' },
    { path: 'nav', component: NavComponent },
    { path: 'search', component: SearchComponent },
    { path: 'view', component: ViewComponent }
  ];
  
  @NgModule({
    imports: [ RouterModule.forRoot(routes) ],
    exports: [ RouterModule ]
  })
  
  export class AppRoutingModule {}
  </code></pre>
  
  <p>and then added these imports to app.module.ts:</p>
  
  <pre><code>import { RouterModule } from '@angular/router';
  
  import { AppComponent } from './app.component';
  import { AppRoutingModule } from './app-routing.module';
  </code></pre>
  
  <p>I thought that was all I needed to do, but when I load my app, I get:</p>
  
  <pre><code>ERROR
  Error: StaticInjectorError(AppModule)[RouterOutlet -&gt; ChildrenOutletContexts]: 
  StaticInjectorError(Platform: core)[RouterOutlet -&gt; ChildrenOutletContexts]: 
  NullInjectorError: No provider for ChildrenOutletContexts!
  </code></pre>
  
  <p>I googled this error and found: <a href="https://stackoverflow.com/questions/46108581/no-provider-for-childrenoutletcontexts-injectionerror">No provider for ChildrenOutletContexts (injectionError)</a> and <a href="https://stackoverflow.com/questions/47606310/error-no-provider-for-childrenoutletcontexts/47607830">Error: No provider for ChildrenOutletContexts</a> but I don't find these helpful.</p>
  
  <p>Here is my stackblitz: <a href="https://stackblitz.com/edit/angular-j1seie?file=src%2Fapp%2Fapp.module.ts" rel="nofollow noreferrer">https://stackblitz.com/edit/angular-j1seie?file=src%2Fapp%2Fapp.module.ts</a>.</p>
  
  <p>No idea where to go next.</p>