title: RouterModule - Cannot read property 'forRoot' of undefined
body: <p>I'm trying to implement routing in Angular but getting error<br>
  <code>Cannot read property 'forRoot' of undefined</code><br>
  my app.routes.ts file is</p>
  
  <pre><code>import { RouterModule, Routes } from '@angular/router';
  import { LoginComponent } from '../../components/login/login.component';
  import { SignupComponent } from '../../components/signup/signup.component';
  import { ResourcesComponent } from '../../components/resources/resources.component';
  import { MyApp } from './app.component';
  const routes: Routes=[
      {path:'',component:MyApp},
      {path:'login',component:LoginComponent},
      {path:'signup', component:SignupComponent},
      {path:'resources',component:ResourcesComponent},
  ];
  export const routing=RouterModule.forRoot(routes);
  </code></pre>
  
  <p>app.module.ts file</p>
  
  <pre><code>import { NgModule, ErrorHandler } from '@angular/core';
  import { BrowserModule } from '@angular/platform-browser';
  import { MyApp } from './app.component';
  import { LoginComponent } from '../../components/login/login.component';
  import { SignupComponent } from '../../components/signup/signup.component';
  import { ResourcesComponent } from '../../components/resources/resources.component'; 
  import { NavbarComponent } from '../../components/navbar/navbar.component';
  import { RouterModule, Routes } from '@angular/router';
  import { routes } from './app.routes';
  
  @NgModule({
      declarations:[
          MyApp,
          LoginComponent,
          SignupComponent,
          ResourcesComponent,
          NavbarComponent
      ],
      entryComponents: [MyApp],
      imports:[BrowserModule,RouterModule.forRoot(routes)],
      bootstrap: [MyApp]
  })
  export class AppModule {}
  </code></pre>
  
  <p>but gets error for RouterModule and routes i.e. @angular/router/index has no exported member 'RouterModule' and 'Routes'</p>