Module Reference — Fundamentals · NestJS

Ask the container for providers by hand with ModuleRef: get() by class, resolve() for a transient instance, a global lookup with strict false, and create() for a class the container does not own.

What you will learn

Read the theory for Module Reference

All Fundamentals lessons

All NestJS courses

loading types…

What you'll learn

  • Retrieve a provider chosen at runtime with ModuleRef.get(), and know why get() refuses scoped providers
  • Resolve a transient provider per call with resolve(), and share a sub-tree between calls with a context id
  • Look a provider up across module boundaries with { strict: false }, and instantiate an unregistered class with create()