Skip to content

Commit

Permalink
Merge pull request #10 from ngrx/master
Browse files Browse the repository at this point in the history
chore(docs): Add meta reducers injection in the Store docs (#341)
  • Loading branch information
GulajavaMinistudio authored Sep 2, 2017
2 parents c4bb6ca + a82f675 commit 736889a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/store/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
26 changes: 26 additions & 0 deletions docs/store/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,29 @@ export const reducers: ActionReducerMap<fromFeature.State> = {
})
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 {}
```

0 comments on commit 736889a

Please sign in to comment.