Created
May 5, 2022 17:00
-
-
Save alxhub/3dbff1abf0e950bc7f34e2b5430b4ff7 to your computer and use it in GitHub Desktop.
ngrx add features example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | |
}, | |
]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment