diff --git a/modules/@angular/compiler/src/runtime_compiler.ts b/modules/@angular/compiler/src/runtime_compiler.ts index 524d249e1f..b06e0a30e9 100644 --- a/modules/@angular/compiler/src/runtime_compiler.ts +++ b/modules/@angular/compiler/src/runtime_compiler.ts @@ -44,13 +44,13 @@ export class RuntimeCompiler implements Compiler { private _compiledNgModuleCache = new Map>(); constructor( - private _injector: Injector, private _metadataResolver: CompileMetadataResolver, + private __injector: Injector, private _metadataResolver: CompileMetadataResolver, private _templateNormalizer: DirectiveNormalizer, private _templateParser: TemplateParser, private _styleCompiler: StyleCompiler, private _viewCompiler: ViewCompiler, private _ngModuleCompiler: NgModuleCompiler, private _compilerConfig: CompilerConfig, private _console: Console) {} - get injector(): Injector { return this._injector; } + get _injector(): Injector { return this.__injector; } compileModuleSync(moduleType: ConcreteType): NgModuleFactory { return this._compileModuleAndComponents(moduleType, true).syncResult; @@ -381,7 +381,7 @@ class ModuleBoundCompiler implements Compiler, ComponentResolver { private _delegate: RuntimeCompiler, private _ngModule: ConcreteType, private _parentComponentResolver: ComponentResolver, private _console: Console) {} - get injector(): Injector { return this._delegate.injector; } + get _injector(): Injector { return this._delegate._injector; } resolveComponent(component: Type|string): Promise> { if (isString(component)) { diff --git a/modules/@angular/core/src/linker/compiler.ts b/modules/@angular/core/src/linker/compiler.ts index 17e54c3df1..59df4df5a6 100644 --- a/modules/@angular/core/src/linker/compiler.ts +++ b/modules/@angular/core/src/linker/compiler.ts @@ -41,10 +41,8 @@ export class ComponentStillLoadingError extends BaseException { export class Compiler { /** * Returns the injector with which the compiler has been created. - * - * @internal */ - get injector(): Injector { + get _injector(): Injector { throw new BaseException(`Runtime compiler is not loaded. Tried to read the injector.`); } diff --git a/modules/@angular/core/testing/test_bed.ts b/modules/@angular/core/testing/test_bed.ts index ca117f129a..10e485f4a8 100644 --- a/modules/@angular/core/testing/test_bed.ts +++ b/modules/@angular/core/testing/test_bed.ts @@ -168,7 +168,7 @@ export class TestBed implements Injector { // Tests can inject things from the ng module and from the compiler, // but the ng module can't inject things from the compiler and vice versa. let result = this._moduleRef.injector.get(token, UNDEFINED); - return result === UNDEFINED ? this._compiler.injector.get(token, notFoundValue) : result; + return result === UNDEFINED ? this._compiler._injector.get(token, notFoundValue) : result; } execute(tokens: any[], fn: Function): any { diff --git a/tools/public_api_guard/core/index.d.ts b/tools/public_api_guard/core/index.d.ts index d5c8be1aca..61b230e2d8 100644 --- a/tools/public_api_guard/core/index.d.ts +++ b/tools/public_api_guard/core/index.d.ts @@ -237,6 +237,7 @@ export declare class CollectionChangeRecord { /** @stable */ export declare class Compiler { + _injector: Injector; clearCache(): void; clearCacheFor(type: Type): void; compileComponentAsync(component: ConcreteType, ngModule?: Type): Promise>;