W3cubDocs

/Angular 10

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: Injector
  abstract componentFactoryResolver: ComponentFactoryResolver
  abstract instance: T
  abstract destroy(): void
  abstract onDestroy(callback: () => void): void
}

Properties

Property Description
abstract injector: Injector Read-Only

The injector that contains all of the providers of the NgModule.

abstract componentFactoryResolver: ComponentFactoryResolver Read-Only

The resolver that can retrieve the component factories declared in the entryComponents property of the module.

abstract instance: T Read-Only

The NgModule instance.

Methods

Destroys the module instance and all of the data structures associated with it.

abstract destroy(): void

Parameters

There are no parameters.

Returns

void

Registers a callback to be executed when the module is destroyed.

abstract onDestroy(callback: () => void): void

Parameters
callback () => void
Returns

void

© 2010–2020 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v10.angular.io/api/core/NgModuleRef