#ConfigurableModuleClass static register method does not accept imports, inject, useFactory etc.

10 messages · Page 1 of 1 (latest)

neon dirge
#

ConfigurableModuleClass static register method does not accept imports, inject, useFactory although it is possible to use them without using ConfigurableModuleBuilder. I am aware that the above mentioned can be achieved using the async methods (such as registerAsync). Just curious as to why this is the default behaviour

storm plank
#

Are you meaning how when using the ConfigurableModuleBuilder the resulting module's register (or forRoot) method doesn't allow you to inject or imports with an async module declaration object?

neon dirge
#

@storm plank yes correct

storm plank
#

Well, because that's how we view that dynamic modules should be written. The non-async method should be a direct passing of the value you need. The async value should be able to be either async (via useFactory) or it should require DI and another provider (like the ConfigService) to be setup properly

neon dirge
#

Okay. Makes sense. Would be great if this would have been added as a clarification in the docs. (The docs are an absolute gem btw💎)

storm plank
#

Plus, this is how all of the dynamic modules in the docs are shown in the first place 🙂

neon dirge
#
storm plank
#

Yep

neon dirge