Skip to content

Commit

Permalink
Add meta reducers injection in the Store docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurent Goudet committed Sep 1, 2017
1 parent 870a73d commit 7e4155b
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions docs/store/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,27 @@ export const reducers: ActionReducerMap<fromFeature.State> = {
})
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 {}
```

0 comments on commit 7e4155b

Please sign in to comment.