title: On production build getting ' Uncaught (in promise): Error: StaticInjectorError(a)[t]:'....
body: <p>Angular 6 App works fine on ng build.</p>
  
  <p>But on ng build --prod app UI gets loaded but on login i ll get coorect data from server, after that i am navigating to dashboard page through the code <code>this.router.navigate(['/dashboard']);</code> there i am getting error as follows </p>
  
  <p>ERROR Error: Uncaught (in promise): Error: StaticInjectorError(a)[t]: StaticInjectorError(Platform: core)[t]: NullInjectorError: No provider for t! Error: StaticInjectorError(a)[t]: StaticInjectorError(Platform: core)[t]: NullInjectorError: No provider for t! at t.get (main.aa8ef128615c160bd861.js:1) at main.aa8ef128615c160bd861.js:1 at t (main.aa8ef128615c160bd861.js:1) at t.get (main.aa8ef128615c160bd861.js:1) at main.aa8ef128615c160bd861.js:1 at t (main.aa8ef128615c160bd861.js:1) at t.get (main.aa8ef128615c160bd861.js:1) at Da (main.aa8ef128615c160bd861.js:1) at t.get (main.aa8ef128615c160bd861.js:1) at t.getToken (main.aa8ef128615c160bd861.js:1) at t.get (main.aa8ef128615c160bd861.js:1) at main.aa8ef128615c160bd861.js:1 at t (main.aa8ef128615c160bd861.js:1) at t.get (main.aa8ef128615c160bd861.js:1) at main.aa8ef128615c160bd861.js:1 at t (main.aa8ef128615c160bd861.js:1) at t.get (main.aa8ef128615c160bd861.js:1) at Da (main.aa8ef128615c160bd861.js:1) at t.get (main.aa8ef128615c160bd861.js:1) at t.getToken (main.aa8ef128615c160bd861.js:1) at j (polyfills.9a5f6d04e0781d28c53e.js:1) at j (polyfills.9a5f6d04e0781d28c53e.js:1) at polyfills.9a5f6d04e0781d28c53e.js:1 at e.invokeTask (polyfills.9a5f6d04e0781d28c53e.js:1) at Object.onInvokeTask (main.aa8ef128615c160bd861.js:1) at e.invokeTask (polyfills.9a5f6d04e0781d28c53e.js:1) at t.runTask (polyfills.9a5f6d04e0781d28c53e.js:1) at d (polyfills.9a5f6d04e0781d28c53e.js:1) at t.invokeTask [as invoke] (polyfills.9a5f6d04e0781d28c53e.js:1) at _ (polyfills.9a5f6d04e0781d28c53e.js:1)</p>
  
  <p>My App.module.ts looks like,</p>
  
  <pre><code> import { BrowserModule } from '@angular/platform-browser';
  import { NgModule } from '@angular/core';
  import { BsDatepickerModule } from 'ngx-bootstrap';
  import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
  import { HttpClientModule } from '@angular/common/http';
  import { ChartsModule } from 'ng2-charts';
  
  import { AppComponent } from './app.component';
  import { HomeComponent } from './home/home.component';
  import { MaterialModule } from './angular-material/material.module';
  import { DashboardComponent } from './dashboard/dashboard.component';
  import { AppRoutingModule } from './app.routing-module';
  import { FiltersComponent } from './filters/filters.component';
  import { SearchComponent } from './search/search.component';
  import { ChartComponent } from './chart/chart.component';
  import { FormsModule, ReactiveFormsModule } from '@angular/forms';
  import { KeysPipe } from './shared/pipes/keys.pipe';
  import { PdfViewerModule } from 'ng2-pdf-viewer';
  import { AboutComponent } from './about/about.component';
  @NgModule({
    declarations: [
      AppComponent,
      HomeComponent,
      DashboardComponent,
      FiltersComponent,
      SearchComponent,
      ChartComponent,
      KeysPipe,
      AboutComponent
    ],
    imports: [
      BrowserModule,
      BrowserAnimationsModule,
      FormsModule,
      ReactiveFormsModule,
      MaterialModule,
      ChartsModule,
      HttpClientModule,
      BsDatepickerModule.forRoot(),
      AppRoutingModule,
      PdfViewerModule
    ],
    providers: [],
    bootstrap: [AppComponent]
  })
  export class AppModule { }
  </code></pre>
  
  <p>App environment is:- </p>
  
  <pre><code>    Angular CLI: 6.0.8
  Node: 10.2.1
  OS: linux x64
  Angular: 6.0.4
  ... animations, common, compiler, compiler-cli, core, forms
  ... http, language-service, platform-browser
  ... platform-browser-dynamic, router
  
  - 0.6.8, .6.8, .6.8, .6.8, -0.6.8, @angular/cdk -6.2.1, @angular/cli -6.0.8, @angular/material - 6.2.1, - 6.0.8, .6.8, - 0.6.8 , rxjs-6.2.1, typescript -2.7.2, webpack -4.8.3
  </code></pre>