How can I pass a service from signalStore to signalStoreFeature? #4865
-
In store, when using:
Is it possible to pass a service to the custom signalStoreFeature? I can't inject in the feature itself because the service passed should be different for every store in which the feature will be used. How can I do it? Thank you! |
Beta Was this translation helpful? Give feedback.
Answered by
rainerhahnekamp
Jul 4, 2025
Replies: 1 comment 2 replies
-
Of couse. According to your snippet, your feature expects the instance but you want to pass the class instead. You could do: withCustomFeature<StoreService>(ServiceClass: new () => StoreService)` or more Angular-specific import { ProviderToken } from '@angular/core';
withCustomFeature<StoreService>(ServiceClass: ProviderToken<StoreService>) |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
rainerhahnekamp
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Of couse. According to your snippet, your feature expects the instance but you want to pass the class instead.
You could do:
or more Angular-specific