title: Angular6: Error: StaticInjectorError(AppModule)[[object Object]]
body: <p>I have searched a lot about this error and nothing was useful, this kind of error usually angular tells you what is the object that lacks a provider, however this time it's giving that StaticInjectorError(AppModule)[[<strong>object Object</strong>]], so I couldn't figure it out.</p>
  
  <p>In my app, I have separate modules:</p>
  
  <ol>
  <li>appModule</li>
  <li>expensesModule</li>
  <li>accountsmodule</li>
  </ol>
  
  <p>each of them has a routing module
  Indeed, I am using lazyloading to route across modules.
  The account-routing-module contains:</p>
  
  <pre><code>const routes: Routes = [
        {
          path: '',
          component: AccountsComponent,
          canActivate: [AuthGuardService],
          resolve: {
            data:{
              AccountsResolver
            }
          }
        }
      ];
  
  @NgModule({
    imports: [RouterModule.forChild(routes)],
    exports: [RouterModule],
    providers: [
      AccountsResolver
    ]
  
  })
  export class AccountsRoutingModule {
  }
  </code></pre>
  
  <p>when I access the accountscomponent, the following error appears:</p>
  
  <blockquote>
    <p></p>
  </blockquote>
  
  <pre><code>ERROR Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[[object Object]]: 
    StaticInjectorError(Platform: core)[[object Object]]: 
      NullInjectorError: No provider for [object Object]!
  Error: StaticInjectorError(AppModule)[[object Object]]: 
    StaticInjectorError(Platform: core)[[object Object]]: 
      NullInjectorError: No provider for [object Object]!
      at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (vendor.js:53611)
      at resolveToken (vendor.js:53850)
      at tryResolveToken (vendor.js:53795)
      at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (vendor.js:53690)
      at resolveToken (vendor.js:53850)
      at tryResolveToken (vendor.js:53795)
      at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (vendor.js:53690)
      at resolveNgModuleDep (vendor.js:60745)
      at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (vendor.js:61433)
      at resolveNgModuleDep (vendor.js:60745)
      at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (vendor.js:53611)
      at resolveToken (vendor.js:53850)
      at tryResolveToken (vendor.js:53795)
      at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (vendor.js:53690)
      at resolveToken (vendor.js:53850)
      at tryResolveToken (vendor.js:53795)
      at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (vendor.js:53690)
      at resolveNgModuleDep (vendor.js:60745)
      at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (vendor.js:61433)
      at resolveNgModuleDep (vendor.js:60745)
      at resolvePromise (polyfills.js:3136)
      at resolvePromise (polyfills.js:3093)
      at polyfills.js:3195
      at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (polyfills.js:2743)
      at Object.onInvokeTask (vendor.js:56325)
      at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (polyfills.js:2742)
      at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (polyfills.js:2510)
      at drainMicroTaskQueue (polyfills.js:2917)
  defaultErrorLogger @ vendor.js:54201
  </code></pre>
  
  <p>but when I comment out the AccountsResolver in the resolve, the component loads normally without any error.
  I don't know if the error is because of the AccountsResolver which implements Resolve, or because of something else. Any idea will be appreciated. Thank you.</p>