On this page
NgModuleRef
class
Represents an instance of an NgModule created by an NgModuleFactory. Provides access to the NgModule instance and related objects.
abstract class NgModuleRef<T> {
  abstract injector: EnvironmentInjector
  abstract componentFactoryResolver: ComponentFactoryResolver
  abstract instance: T
  abstract destroy(): void
  abstract onDestroy(callback: () => void): void
}
   Properties
| Property | Description | 
|---|---|
abstract injector: EnvironmentInjector | 
       Read-Only  The injector that contains all of the providers of the   | 
      
abstract componentFactoryResolver: ComponentFactoryResolver | 
       Deprecated Read-Only The resolver that can retrieve component factories in a context of this module. Note: since v13, dynamic component creation via  Deprecated Angular no longer requires Component factories. Please use other APIs where Component class can be used directly.  | 
      
abstract instance: T | 
       Read-Only  The   | 
      
Methods
| 
         
         destroy()
          | 
      
|---|
Destroys the module instance and all of the data structures associated with it.  | 
      
        
          | 
      
| 
         
         onDestroy()
          | 
      |||
|---|---|---|---|
Registers a callback to be executed when the module is destroyed.  | 
      |||
        
          | 
      
callback | 
            () => void | 
            
Returns
void
© 2010–2023 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
 https://angular.io/api/core/NgModuleRef