Cookies concent notice

This site uses cookies from Google to deliver its services and to analyze traffic.
Learn more
Skip to main content
This site is no longer updated.Head to Angular.devHome
/

This is the archived documentation for Angular v17. Please visit angular.dev to see this page for the current version of Angular.

createNgModule

Returns a new NgModuleRef instance based on the NgModule class and parent injector provided.

      
      createNgModule<T>(ngModule: Type<T>, parentInjector?: Injector): viewEngine_NgModuleRef<T>
    
Parameters
ngModule Type<T>

NgModule class.

parentInjector Injector

Optional injector instance to use as a parent for the module injector. If not provided, NullInjector will be used instead.

Optional. Default is undefined.

Returns

viewEngine_NgModuleRef<T>: NgModuleRef that represents an NgModule instance.