Skip to content
This repository was archived by the owner on Jul 8, 2021. It is now read-only.

Commit 46b9e08

Browse files
author
Austin McDaniel
committed
feat: add di
1 parent 39a21f6 commit 46b9e08

8 files changed

+1040
-13
lines changed

CHANGELOG.md

+13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# 3.0.0 - 2/26/18
2+
- Feature: Added ability to use DI with Stores
3+
4+
Example:
5+
```
6+
@NgModule({
7+
imports: [
8+
NgrxActionsModule.forRoot({ pizza: MyStore })
9+
]
10+
providers: [MyStore]
11+
})
12+
```
13+
114
# 2.4.2 - 2/14/18
215
- Per: Improve `Select` perf by caching get
316
- Revert: Revert `prototype.name` attempts since ngrx won't support it

README.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,29 @@ Next, pass that to your NGRX module just like normal:
111111
@NgModule({
112112
imports: [
113113
StoreModule.forRoot({
114-
myReducer
114+
pizza: pizzaReducer
115115
})
116116
]
117117
})
118118
export class AppModule {}
119119
```
120120

121+
Optionally you can also provide your store directly to the `NgrxActionsModule` and it will handle
122+
creating the reducer for you and also enables the ability to use DI with your stores. So rather than
123+
describing in `forRoot` or `forFeature` with `StoreModule`, we call them on `NgrxActionsModule`.
124+
125+
```javascript
126+
@NgModule({
127+
imports: [
128+
NgrxActionsModule.forRoot({
129+
pizza: PizzaStore
130+
})
131+
],
132+
providers: [PizzaStore]
133+
})
134+
export class AppModule {}
135+
```
136+
121137
### Effects
122138
If you want to use NGRX effects, I've created a lettable operator that will allow you to
123139
pass the action class as the argument like this:

0 commit comments

Comments
 (0)