#How to instantiate any class with Nest DI without injecting them into the provider?

1 messages · Page 1 of 1 (latest)

hushed jewel
cerulean kiln
#

So, you want to create the instance on demand/when you want, but you want Nest to do the injections for you?

hushed jewel
#

yes

cerulean kiln
hushed jewel
#

do i need to inject the class into providers before doing this?

cerulean kiln
#

Just the ModuleRef class, from what I remember

#

I haven't used this approach much

hushed jewel
#

okay let me try this

#

i need to decorate the classes with @Injectable

cerulean kiln
#

Almost guaranteed

hushed jewel
#

Hi, how do i get the metadata i set on the class with dcoarator

cerulean kiln
#

What metadata are you looking for in particular?

hushed jewel
#

metadata set by SetMetadata

cerulean kiln
#

Then you'll probably use the Reflector class to get the metadata by the same key you used to set it