Error: No provider for Store! when trying @ngrx/store with Angular 4.0
In app.module.ts
add:
// Make sure you import from @ngrx/store
import { StoreModule } from '@ngrx/store';
@NgModule({
imports: [
StoreModule.forRoot({ characters, vehicles }),
...
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
Just for sake of completeness, with Angular 5 / Ngrx 4.1.1 it would be (in app.module.ts):
import { StoreModule } from '@ngrx/store';
import { reducers } from './reducers/reducers';
@NgModule({
imports: [
StoreModule.forRoot(reducers),
...
],
...
There is a complete example here