Skip to content

Commit

Permalink
Update projects/ngrx.io/content/guide/store/actions.md
Browse files Browse the repository at this point in the history
  • Loading branch information
markostanimirovic authored and rainerhahnekamp committed Nov 27, 2024
1 parent 7e0321f commit 31fdb74
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion projects/ngrx.io/content/guide/store/actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,9 @@ When passing a function to the `dispatch` method, it returns an `EffectRef`. For
class BookComponent {
bookId = input.required<number>();
loadBookEffectRef: EffectRef | undefined;
store = inject(Store);

ngOnInit(store: Store) {
ngOnInit() {
// uses the injection context of Store, i.e. root injector
this.loadBookEffectRef = store.dispatch(() => loadBook({ id: this.bookId() }));
}
Expand Down

0 comments on commit 31fdb74

Please sign in to comment.