Comments (5)
Yes, please. I am running into trouble with setting up the modules for the AppModule and each of my Store module. It would be good to see all of the @NgModule bits need to wire everything up.
from ngrx-actions.
same for me. Here I tried to exercise with a simple Effect: https://stackblitz.com/edit/angular-qddzem?file=app%2Ftodos%2Ftodos.module.ts
On console I get NullInjectorError: No provider for ReducerManager!
from ngrx-actions.
Here is what I had to use to get this working. I am hoping that there is a way to reduce some of this. The reducers and metareducers seem like they are duplicating some of what NgrxActionsModule.forRoot should do, but I found it was needed to get things to work. Perhaps there is a better way.
BUT, I do love that I can combine my @actions and @effects into one class. It helps to not have to jump to several files just to handle one user action. I would like to see a way to create one file that would combine the actions, effects and actions classes for one user action into one place.
This is from my app.module.ts:
export interface AppState {
order: OrderStore;
}
export const reducers: ActionReducerMap<AppState> = { order: null };
export const metaReducers: MetaReducer<AppState>[] = !environment.production ? [storeFreeze] : [];
@NgModule({
declarations: [AppComponent, TopMenuComponent],
imports: [
CommonModule,
BrowserModule,
BrowserAnimationsModule,
HttpModule,
HttpClientModule,
AppRoutingModule,
OrderModule,
StoreModule.forRoot(reducers, { metaReducers }),
NgrxActionsModule.forRoot({
order: OrderStore
}),
!environment.production ? StoreDevtoolsModule.instrument() : []
],
bootstrap: [AppComponent]
})
And here is an excerpt from my order.module.ts:
@NgModule({
imports: [
CommonModule,
FormsModule,
ReactiveFormsModule,
RouterModule.forChild(routes),
NgrxActionsModule.forFeature({ order: OrderStore })
],
declarations: [
OrderPageComponent,
OrderListComponent
],
providers: [OrderStore, OrderService],
exports: [RouterModule]
})
I hope that helps.
from ngrx-actions.
@RobCannon you actually do not need to pass any reducers into forRoot of the StoreModule import. This works just fine: StoreModule.forRoot([])
from ngrx-actions.
@lanovoy Thanks! One slight change to support store freeze:
StoreModule.forRoot({}, { metaReducers: !environment.production ? [storeFreeze] : [] }),
NgrxActionsModule.forRoot({
order: OrderStore
}),
!environment.production ? StoreDevtoolsModule.instrument() : []
from ngrx-actions.
Related Issues (20)
- Action options HOT 1
- Store DI
- Example Stored + Entity HOT 3
- Return Store initial state to be used in the tests
- Can it be used with redux? HOT 1
- New @Effect decorator HOT 3
- @Action - samples in the README and articles are incorrect?
- NgrxActionsModule.forFeature - not working?
- @Dispatch
- Question: Unit testing with the @Select decorator
- RxJs 6 - Property 'pipe' does not exist in type 'Actions<Action>' HOT 1
- feat: support angular v6
- Question: any ETA for a ng6 compatible version? HOT 5
- Cannot find module 'ngrx-actions' HOT 8
- NgrxActionsModule nested reducers
- Publish 4.0.1 to NPM?
- Unexpected state mutation in reducers
- @Effect() decorator does not work HOT 1
- NGRX 7.x Upgrade HOT 2
- PLEASE DELETE. CREATED BY MISTAKE :D
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngrx-actions.