How to pass ngrx signal store as a required input to a component - Stack Overflow

admin2025-04-17  4

The below code works on a component to pass an ngrx signal store as a parameter to the component.

listingAddInfoStore = input(inject(ListingAddInfoStore));

I want to make it a required parameter like so

listingAddInfoStore = input.requried<>()

The issue I am running into is the type for input required. I have tried

listingAddInfoStore = input.required<ListingAddInfoStore>()

and

listingAddInfoStore = input.required<typeof ListingAddInfoStore>()

with no luck.

The below code works on a component to pass an ngrx signal store as a parameter to the component.

listingAddInfoStore = input(inject(ListingAddInfoStore));

I want to make it a required parameter like so

listingAddInfoStore = input.requried<>()

The issue I am running into is the type for input required. I have tried

listingAddInfoStore = input.required<ListingAddInfoStore>()

and

listingAddInfoStore = input.required<typeof ListingAddInfoStore>()

with no luck.

Share Improve this question asked Feb 1 at 11:51 JMIIIJMIII 4043 silver badges18 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Figured it out. Have to use InstanceType

listingAddInfoStore = input.required<InstanceType<typeof ListingAddInfoStore>>();

转载请注明原文地址:http://anycun.com/QandA/1744829656a88202.html