Search code examples
ngrx-signal-store

How to pass ngrx signal store as a required input to a component


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.


Solution

  • Figured it out. Have to use InstanceType

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