You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: projects/ngrx.io/content/guide/effects/index.md
+21Lines changed: 21 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -225,6 +225,27 @@ export class MovieModule {}
225
225
226
226
</div>
227
227
228
+
## Alternative way of registering effects
229
+
230
+
You can provide root-/feature-level effects with the provider `USER_PROVIDED_EFFECTS`.
231
+
232
+
<code-exampleheader="movies.module.ts">
233
+
providers: [
234
+
MovieEffects,
235
+
{
236
+
provide: USER_PROVIDED_EFFECTS,
237
+
multi: true,
238
+
useValue: [MovieEffects],
239
+
},
240
+
]
241
+
</code-example>
242
+
243
+
<divclass="alert is-critical">
244
+
245
+
The `EffectsModule.forFeature()` method must be added to the module imports even if you only provide effects over token, and don't pass them via parameters. (Same goes for `EffectsModule.forRoot()`)
246
+
247
+
</div>
248
+
228
249
## Incorporating State
229
250
230
251
If additional metadata is needed to perform an effect besides the initiating action's `type`, we should rely on passed metadata from an action creator's `props` method.
0 commit comments