Credit to devdocs.io

angular 2.0_typescript

angular

Compiler

Stable Class

Class Overview

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

Class 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.

Class Details

compileModuleSync(moduleType: Type<T>) : NgModuleFactory<T>

Compiles the given NgModule and all of its components. All templates of the components listed in entryComponents have to be inlined. Otherwise throws a ComponentStillLoadingError.

compileModuleAsync(moduleType: Type<T>) : Promise<NgModuleFactory<T>>

Compiles the given NgModule and all of its components

compileModuleAndAllComponentsSync(moduleType: Type<T>) : ModuleWithComponentFactories<T>

Same as compileModuleSync but also creates ComponentFactories for all components.

compileModuleAndAllComponentsAsync(moduleType: Type<T>) : Promise<ModuleWithComponentFactories<T>>

Same as compileModuleAsync but also creates ComponentFactories for all components.

clearCache() : void

Clears all caches.

clearCacheFor(type: Type<any>)

Clears the cache for the given component/ngModule.

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

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