W3cubDocs

/Angular 2

NgModuleRef

Stable Class

Class Overview

class NgModuleRef {
  injector : Injector
  componentFactoryResolver : ComponentFactoryResolver
  instance : T
  destroy() : void
  onDestroy(callback: () => void) : void
}

Class Description

Represents an instance of an NgModule created via a NgModuleFactory.

NgModuleRef provides access to the NgModule Instance as well other objects related to this NgModule Instance.

Class Details

injector : Injector

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

componentFactoryResolver : ComponentFactoryResolver

The ComponentFactoryResolver to get hold of the ComponentFactories declared in the entryComponents property of the module.

instance : T

The NgModule instance.

destroy() : void

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

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

Allows to register a callback that will be called when the module is destroyed.

exported from @angular/core/index, defined in @angular/core/src/linker/ng_module_factory.ts

© 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v2.angular.io/docs/ts/latest/api/core/index/NgModuleRef-class.html