Function: withFeatureFactory()
withFeatureFactory<
Input,Output>(factoryFn):SignalStoreFeature<Input,Output>
Defined in: libs/ngrx-toolkit/src/lib/with-feature-factory.ts:37
Type Parameters
• Input extends SignalStoreFeatureResult
• Output extends SignalStoreFeatureResult
Parameters
factoryFn
(store) => SignalStoreFeature<Input, Output>
Returns
SignalStoreFeature<Input, Output>
Deprecated
Use import { withFeature } from '@ngrx/signals' instead, starting with ngrx/signals 19.1: https://ngrx.io/guide/signals/signal-store/custom-store-features#connecting-a-custom-feature-with-the-store
Allows to pass properties, methods, or signals from a SignalStore to a feature.
Typically, a signalStoreFeature can have input constraints on
function withSum(a: Signal<number>, b: Signal<number>) {
return signalStoreFeature(
withComputed(() => ({
sum: computed(() => a() + b())
}))
);
}
signalStore(
withState({ a: 1, b: 2 }),
withFeatureFactory((store) => withSum(store.a, store.b))
);