Skip to content

Instantly share code, notes, and snippets.

@alxhub
Created May 5, 2022 17:00
Show Gist options
  • Select an option

  • Save alxhub/3dbff1abf0e950bc7f34e2b5430b4ff7 to your computer and use it in GitHub Desktop.

Select an option

Save alxhub/3dbff1abf0e950bc7f34e2b5430b4ff7 to your computer and use it in GitHub Desktop.

Revisions

  1. alxhub created this gist May 5, 2022.
    18 changes: 18 additions & 0 deletions ngrx.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    function configureStoreWithFeature(feature: ...): Provider[] {
    return [
    {
    provide: Store,
    useFactory: () => {
    const rootStore = inject(RootStore);
    for (const feature of inject(STORE_FEATURE, [])) {
    rootStore.registerFeature(feature);
    }
    return rootStore;
    },
    }, {
    provide: STORE_FEATURE,
    useValue: feature,
    multi: true,
    },
    ];
    }