Error: No provider for Store! when trying @ngrx/store with Angular 4.0

Viewed 26511

Problem: Error: No provider for Store!

I'm bootstraping store module in main.ts:

platformBrowserDynamic().bootstrapModule(AppModule,[
  provideStore({
    characters, 
    vehicles
  })
]);

And injecting in to vehicle.component.ts:

constructor(
    private _route: ActivatedRoute,
    private _router: Router,
    private _vehicleService: VehicleService,
    private _store: Store<any>
  ) {}

Full source code is here: GitHub, last version running on GitHub Pages

PS. Adding Store to providers leads to another error: Can't resolve all parameters for Store: (?, ?, ?).

3 Answers

I had this error because, in my component auto-import imported Store from import { Store } from '@ngrx/store/src/store' instead of import { Store } from '@ngrx/store'; . Anyway, this was in Angular 5

Related