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: (?, ?, ?).
Where Does NgRx Store Data? NgRx stores the application state in an RxJS observable inside an Angular service called Store. At the same time, this service implements the Observable interface.
store. dispatch(logout()); In effects, dispatch logout success action so that the user logs out and the store is reset.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With