diff --git a/docs/store/README.md b/docs/store/README.md index 3f90a4d38e..e9949299a0 100644 --- a/docs/store/README.md +++ b/docs/store/README.md @@ -117,6 +117,7 @@ export class MyAppComponent { - [Action Reducers](./actions.md#action-reducers) - [Injecting reducers](./api.md#injecting-reducers) - [Meta-Reducers/Enhancers](./api.md#meta-reducers) +- [Injecting Meta-Reducers](./api.md#injecting-meta-reducers) - [Providing initial state](./api.md#initial-state) - [State composition through feature modules](./api.md#feature-module-state-composition) - [State selectors](./selectors.md) diff --git a/docs/store/api.md b/docs/store/api.md index 9143cedbfe..f855d583c4 100644 --- a/docs/store/api.md +++ b/docs/store/api.md @@ -158,3 +158,29 @@ export const reducers: ActionReducerMap = { }) export class FeatureModule { } ``` + +## Injecting Meta-Reducers + +To inject meta reducers, use the `META_REDUCERS` injection token exported in +the Store API and a `Provider` to register the meta reducers through dependency +injection. + +``` +import { MetaReducer, META_REDUCERS } '@ngrx/store'; +import { SomeService } from './some.service'; + +export function getMetaReducers(some: SomeService): MetaReducer[] { + // return array of meta reducers; +} + +@NgModule({ + providers: [ + { + provide: META_REDUCERS, + deps: [SomeService], + useFactory: getMetaReducers + } + ] +}) +export class AppModule {} +```