class
deprecated
final
Low-level service for running the angular compiler during runtime to create ComponentFactory
s, which can later be used to create and render a Component instance.
Deprecated: Ivy JIT mode doesn't require accessing this symbol. See JIT API changes due to ViewEngine deprecation for additional context.
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>) getModuleId(moduleType: Type<any>): string | undefined }
'root'
Each @NgModule
provides an own Compiler
to its injector, that will use the directives/pipes of the ng module for compilation of components.
compileModuleSync() |
---|
Compiles the given NgModule and all of its components. All templates of the components have to be inlined. |
compileModuleAsync() | |||
---|---|---|---|
Compiles the given NgModule and all of its components | |||
|
moduleType | Type<T> |
Promise<NgModuleFactory<T>>
compileModuleAndAllComponentsSync() | |||
---|---|---|---|
Same as compileModuleSync but also creates ComponentFactories for all components. | |||
|
moduleType | Type<T> |
compileModuleAndAllComponentsAsync() | |||
---|---|---|---|
Same as compileModuleAsync but also creates ComponentFactories for all components. | |||
|
moduleType | Type<T> |
Promise<ModuleWithComponentFactories<T>>
clearCache() |
---|
Clears all caches. |
|
clearCacheFor() |
---|
Clears the cache for the given component/ngModule. |
getModuleId() | |||
---|---|---|---|
Returns the id for a given NgModule, if one is defined and known to the compiler. | |||
|
moduleType | Type<any> |
string | undefined
© 2010–2023 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://angular.io/api/core/Compiler