• Overview
@angular/core

Compiler

Class
deprecated

Low-level service for running the angular compiler during runtime to create ComponentFactorys, which can later be used to create and render a Component instance.

Deprecation warning

Ivy JIT mode doesn't require accessing this symbol.

API

    
      class Compiler {  compileModuleSync<T>(moduleType: Type<T>): NgModuleFactory<T>;  compileModuleAsync<T>(moduleType: Type<T>): Promise<NgModuleFactory<T>>;  compileModuleAndAllComponentsSync<T>(moduleType: Type<T>): ModuleWithComponentFactories<T>;  compileModuleAndAllComponentsAsync<T>(moduleType: Type<T>): Promise<ModuleWithComponentFactories<T>>;  clearCache(): void;  clearCacheFor(type: Type<any>): void;  getModuleId(moduleType: Type<any>): string | undefined;}
    
    

compileModuleSync

NgModuleFactory<T>

Compiles the given NgModule and all of its components. All templates of the components have to be inlined.

@parammoduleTypeType<T>
@returnsNgModuleFactory<T>

compileModuleAsync

Promise<NgModuleFactory<T>>

Compiles the given NgModule and all of its components

@parammoduleTypeType<T>
@returnsPromise<NgModuleFactory<T>>

compileModuleAndAllComponentsSync

ModuleWithComponentFactories<T>

Same as compileModuleSync but also creates ComponentFactories for all components.

@parammoduleTypeType<T>

compileModuleAndAllComponentsAsync

Promise<ModuleWithComponentFactories<T>>

Same as compileModuleAsync but also creates ComponentFactories for all components.

@parammoduleTypeType<T>
@returnsPromise<ModuleWithComponentFactories<T>>

clearCache

void

Clears all caches.

@returnsvoid

clearCacheFor

void

Clears the cache for the given component/ngModule.

@paramtypeType<any>
@returnsvoid

getModuleId

string | undefined

Returns the id for a given NgModule, if one is defined and known to the compiler.

@parammoduleTypeType<any>
@returnsstring | undefined

Description

Low-level service for running the angular compiler during runtime to create ComponentFactorys, which can later be used to create and render a Component instance.

Each @NgModule provides an own Compiler to its injector, that will use the directives/pipes of the ng module for compilation of components.

Jump to details