I want to pass a lazy component to the foo service as an option without making a direct call. I aim to achieve this using an injection token. Additionally, I want to ensure that the scope of foo is limited to the component instance. This way, I can pass both the injection token and foo to the component providers in the usual manner.
Since I'm using ngxtension, is it possible to provide both the injection token and the foo class in a single provide function?
argument of type '{ extraProviders: (typeof Foo)[]; }' is not assignable to parameter of type 'Pick<CreateInjectionTokenOptions<() > => void, []>, "extraProviders"> & Record<string, never>'.
Type '{ extraProviders: (typeof Foo)[]; }' is not assignable to type 'Record<string, never>'.
Property 'extraProviders' is incompatible with index signature.
Type '(typeof Foo)[]' is not assignable to type 'never
I want to pass a lazy component to the
foo
service as an option without making a direct call. I aim to achieve this using an injection token. Additionally, I want to ensure that the scope offoo
is limited to the component instance. This way, I can pass both the injection token andfoo
to the component providers in the usual manner.Since I'm using
ngxtension
, is it possible to provide both the injection token and thefoo
class in a singleprovide
function?the problem is in
extraProviders
:stackblitz demo
Here is the code: