File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -117,6 +117,7 @@ export class MyAppComponent {
117117- [ Action Reducers] ( ./actions.md#action-reducers )
118118- [ Injecting reducers] ( ./api.md#injecting-reducers )
119119- [ Meta-Reducers/Enhancers] ( ./api.md#meta-reducers )
120+ - [ Injecting Meta-Reducers] ( ./api.md#injecting-meta-reducers )
120121- [ Providing initial state] ( ./api.md#initial-state )
121122- [ State composition through feature modules] ( ./api.md#feature-module-state-composition )
122123- [ State selectors] ( ./selectors.md )
Original file line number Diff line number Diff line change @@ -158,3 +158,29 @@ export const reducers: ActionReducerMap<fromFeature.State> = {
158158})
159159export class FeatureModule { }
160160```
161+
162+ ## Injecting Meta-Reducers
163+
164+ To inject meta reducers, use the ` META_REDUCERS ` injection token exported in
165+ the Store API and a ` Provider ` to register the meta reducers through dependency
166+ injection.
167+
168+ ```
169+ import { MetaReducer, META_REDUCERS } '@ngrx/store';
170+ import { SomeService } from './some.service';
171+
172+ export function getMetaReducers(some: SomeService): MetaReducer[] {
173+ // return array of meta reducers;
174+ }
175+
176+ @NgModule({
177+ providers: [
178+ {
179+ provide: META_REDUCERS,
180+ deps: [SomeService],
181+ useFactory: getMetaReducers
182+ }
183+ ]
184+ })
185+ export class AppModule {}
186+ ```
You can’t perform that action at this time.
0 commit comments