From 7e4155b6a06c30eab9e05bf152ff333827987982 Mon Sep 17 00:00:00 2001 From: Laurent Goudet Date: Fri, 1 Sep 2017 11:14:04 +0200 Subject: [PATCH] Add meta reducers injection in the Store docs --- docs/store/api.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/store/api.md b/docs/store/api.md index 9143cedbfe..217440bd6b 100644 --- a/docs/store/api.md +++ b/docs/store/api.md @@ -158,3 +158,27 @@ export const reducers: ActionReducerMap = { }) export class FeatureModule { } ``` + +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 {} +```