From 73a9ee4a05948d5fb41563e9088495e1fb9c0da2 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Tue, 16 Aug 2016 16:48:32 -0700 Subject: [PATCH] Remove component resolver (#10858) * refactor(core): remove deprecated ComponentResolver BREAKING CHANGE: deprecated ComponentResolver was removed Please follow deprecation instruction and migrate your code to use ComponentFactoryResolver. * refactor(common): remove deprecated NgSwitchWhen directive BREAKING CHANGE: previously deprecated NgSwitchWhen directive was removed, use NgSwitchCase instead --- .../@angular/common/src/common_directives.ts | 4 +- .../common/src/directives/core_directives.ts | 4 +- .../common/src/directives/ng_switch.ts | 15 +---- .../common/test/directives/ng_switch_spec.ts | 6 +- .../@angular/compiler/src/runtime_compiler.ts | 53 +++------------ modules/@angular/core/private_export.ts | 1 - .../@angular/core/src/application_module.ts | 2 - modules/@angular/core/src/linker.ts | 1 - .../core/src/linker/component_resolver.ts | 30 --------- .../core/src/linker/view_container_ref.ts | 2 +- .../core/test/linker/integration_spec.ts | 64 +++++++++++-------- .../test/linker/ng_module_integration_spec.ts | 43 +------------ .../src/largetable/largetable_benchmark.ts | 14 ++-- tools/public_api_guard/common/index.d.ts | 1 - tools/public_api_guard/core/index.d.ts | 8 --- 15 files changed, 62 insertions(+), 186 deletions(-) delete mode 100644 modules/@angular/core/src/linker/component_resolver.ts diff --git a/modules/@angular/common/src/common_directives.ts b/modules/@angular/common/src/common_directives.ts index a7786d661f..177eff2bb6 100644 --- a/modules/@angular/common/src/common_directives.ts +++ b/modules/@angular/common/src/common_directives.ts @@ -24,14 +24,14 @@ import {CORE_DIRECTIVES} from './directives'; * Instead of writing: * * ```typescript - * import {NgClass, NgIf, NgFor, NgSwitch, NgSwitchWhen, NgSwitchDefault, NgModel, NgForm} from + * import {NgClass, NgIf, NgFor, NgSwitch, NgSwitchCase, NgSwitchDefault, NgModel, NgForm} from * '@angular/common'; * import {OtherDirective} from './myDirectives'; * * @Component({ * selector: 'my-component', * templateUrl: 'myComponent.html', - * directives: [NgClass, NgIf, NgFor, NgSwitch, NgSwitchWhen, NgSwitchDefault, NgModel, NgForm, + * directives: [NgClass, NgIf, NgFor, NgSwitch, NgSwitchCase, NgSwitchDefault, NgModel, NgForm, * OtherDirective] * }) * export class MyComponent { diff --git a/modules/@angular/common/src/directives/core_directives.ts b/modules/@angular/common/src/directives/core_directives.ts index 38f271cf4c..5efa97503b 100644 --- a/modules/@angular/common/src/directives/core_directives.ts +++ b/modules/@angular/common/src/directives/core_directives.ts @@ -28,13 +28,13 @@ import {NgTemplateOutlet} from './ng_template_outlet'; * Instead of writing: * * ```typescript - * import {NgClass, NgIf, NgFor, NgSwitch, NgSwitchWhen, NgSwitchDefault} from '@angular/common'; + * import {NgClass, NgIf, NgFor, NgSwitch, NgSwitchCase, NgSwitchDefault} from '@angular/common'; * import {OtherDirective} from './myDirectives'; * * @Component({ * selector: 'my-component', * templateUrl: 'myComponent.html', - * directives: [NgClass, NgIf, NgFor, NgSwitch, NgSwitchWhen, NgSwitchDefault, OtherDirective] + * directives: [NgClass, NgIf, NgFor, NgSwitch, NgSwitchCase, NgSwitchDefault, OtherDirective] * }) * export class MyComponent { * ... diff --git a/modules/@angular/common/src/directives/ng_switch.ts b/modules/@angular/common/src/directives/ng_switch.ts index 94d12a8c0a..e3d9737a99 100644 --- a/modules/@angular/common/src/directives/ng_switch.ts +++ b/modules/@angular/common/src/directives/ng_switch.ts @@ -13,9 +13,6 @@ import {isBlank, isPresent, normalizeBlank} from '../facade/lang'; const _CASE_DEFAULT = new Object(); -// TODO: remove when fully deprecated -let _warned: boolean = false; - export class SwitchView { constructor( private _viewContainerRef: ViewContainerRef, private _templateRef: TemplateRef) {} @@ -182,7 +179,7 @@ export class NgSwitch { * * @experimental */ -@Directive({selector: '[ngSwitchCase],[ngSwitchWhen]'}) +@Directive({selector: '[ngSwitchCase]'}) export class NgSwitchCase { // `_CASE_DEFAULT` is used as a marker for a not yet initialized value /** @internal */ @@ -203,16 +200,6 @@ export class NgSwitchCase { this._switch._onCaseValueChanged(this._value, value, this._view); this._value = value; } - - @Input() - set ngSwitchWhen(value: any) { - if (!_warned) { - _warned = true; - console.warn('*ngSwitchWhen is deprecated and will be removed. Use *ngSwitchCase instead'); - } - this._switch._onCaseValueChanged(this._value, value, this._view); - this._value = value; - } } /** diff --git a/modules/@angular/common/test/directives/ng_switch_spec.ts b/modules/@angular/common/test/directives/ng_switch_spec.ts index 6c62d6c130..2885308a7d 100644 --- a/modules/@angular/common/test/directives/ng_switch_spec.ts +++ b/modules/@angular/common/test/directives/ng_switch_spec.ts @@ -44,11 +44,11 @@ export function main() { })); // TODO(robwormald): deprecate and remove - it('should switch amongst when values using switchWhen', async(() => { + it('should switch amongst when values using switchCase', async(() => { var template = '
' + '
    ' + - '' + - '' + + '' + + '' + '
'; TestBed.overrideComponent(TestComponent, {set: {template: template}}); diff --git a/modules/@angular/compiler/src/runtime_compiler.ts b/modules/@angular/compiler/src/runtime_compiler.ts index ef06c8af8b..7aae1ed20b 100644 --- a/modules/@angular/compiler/src/runtime_compiler.ts +++ b/modules/@angular/compiler/src/runtime_compiler.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {Compiler, ComponentFactory, ComponentResolver, ComponentStillLoadingError, Injectable, Injector, ModuleWithComponentFactories, NgModuleFactory, OptionalMetadata, SchemaMetadata, SkipSelfMetadata, Type} from '@angular/core'; +import {Compiler, ComponentFactory, ComponentStillLoadingError, Injectable, Injector, ModuleWithComponentFactories, NgModuleFactory, OptionalMetadata, Provider, SchemaMetadata, SkipSelfMetadata, Type} from '@angular/core'; import {Console} from '../core_private'; @@ -14,7 +14,7 @@ import {CompileDirectiveMetadata, CompileIdentifierMetadata, CompileNgModuleMeta import {CompilerConfig} from './config'; import {DirectiveNormalizer} from './directive_normalizer'; import {BaseException} from './facade/exceptions'; -import {isBlank, isString, stringify} from './facade/lang'; +import {isBlank, stringify} from './facade/lang'; import {CompileMetadataResolver} from './metadata_resolver'; import {NgModuleCompiler} from './ng_module_compiler'; import * as ir from './output/output_ast'; @@ -124,18 +124,9 @@ export class RuntimeCompiler implements Compiler { let ngModuleFactory = this._compiledNgModuleCache.get(moduleType); if (!ngModuleFactory) { const moduleMeta = this._metadataResolver.getNgModuleMetadata(moduleType); - const transitiveModuleMeta = moduleMeta.transitiveModule; - let boundCompilerFactory = (parentResolver: ComponentResolver) => - new ModuleBoundCompiler(this, moduleMeta.type.runtime, parentResolver, this._console); - // Always provide a bound Compiler and ComponentResolver - const extraProviders = [ - this._metadataResolver.getProviderMetadata(new ProviderMeta(Compiler, { - useFactory: boundCompilerFactory, - deps: [[new OptionalMetadata(), new SkipSelfMetadata(), ComponentResolver]] - })), - this._metadataResolver.getProviderMetadata( - new ProviderMeta(ComponentResolver, {useExisting: Compiler})) - ]; + // Always provide a bound Compiler + const extraProviders = [this._metadataResolver.getProviderMetadata(new ProviderMeta( + Compiler, {useFactory: () => new ModuleBoundCompiler(this, moduleMeta.type.runtime)}))]; var compileResult = this._ngModuleCompiler.compile(moduleMeta, extraProviders); compileResult.dependencies.forEach((dep) => { dep.placeholder.runtime = @@ -405,34 +396,13 @@ function assertComponent(meta: CompileDirectiveMetadata) { } /** - * Implements `Compiler` and `ComponentResolver` by delegating - * to the RuntimeCompiler using a known module. + * Implements `Compiler` by delegating to the RuntimeCompiler using a known module. */ -class ModuleBoundCompiler implements Compiler, ComponentResolver { - private _warnOnComponentResolver = true; - - constructor( - private _delegate: RuntimeCompiler, private _ngModule: Type, - private _parentComponentResolver: ComponentResolver, private _console: Console) {} +class ModuleBoundCompiler implements Compiler { + constructor(private _delegate: RuntimeCompiler, private _ngModule: Type) {} get _injector(): Injector { return this._delegate.injector; } - resolveComponent(component: Type|string): Promise> { - if (isString(component)) { - if (this._parentComponentResolver) { - return this._parentComponentResolver.resolveComponent(component); - } else { - return >Promise.reject( - new BaseException(`Cannot resolve component using '${component}'.`)); - } - } - if (this._warnOnComponentResolver) { - this._console.warn(ComponentResolver.DynamicCompilationDeprecationMsg); - this._warnOnComponentResolver = false; - } - return this.compileComponentAsync(>component); - } - compileComponentAsync(compType: Type, ngModule: Type = null): Promise> { return this._delegate.compileComponentAsync(compType, ngModule ? ngModule : this._ngModule); @@ -461,12 +431,7 @@ class ModuleBoundCompiler implements Compiler, ComponentResolver { /** * Clears all caches */ - clearCache(): void { - this._delegate.clearCache(); - if (this._parentComponentResolver) { - this._parentComponentResolver.clearCache(); - } - } + clearCache(): void { this._delegate.clearCache(); } /** * Clears the cache for the given component/ngModule. diff --git a/modules/@angular/core/private_export.ts b/modules/@angular/core/private_export.ts index 3f200a653a..a1a9bb20aa 100644 --- a/modules/@angular/core/private_export.ts +++ b/modules/@angular/core/private_export.ts @@ -20,7 +20,6 @@ import * as debug from './src/debug/debug_renderer'; import * as provider from './src/di/provider'; import * as reflective_provider from './src/di/reflective_provider'; import * as component_factory_resolver from './src/linker/component_factory_resolver'; -import * as component_resolver from './src/linker/component_resolver'; import * as debug_context from './src/linker/debug_context'; import * as element from './src/linker/element'; import * as ng_module_factory from './src/linker/ng_module_factory'; diff --git a/modules/@angular/core/src/application_module.ts b/modules/@angular/core/src/application_module.ts index fbecfd5399..fc5a50320b 100644 --- a/modules/@angular/core/src/application_module.ts +++ b/modules/@angular/core/src/application_module.ts @@ -12,7 +12,6 @@ import {APP_ID_RANDOM_PROVIDER} from './application_tokens'; import {IterableDiffers, KeyValueDiffers, defaultIterableDiffers, defaultKeyValueDiffers} from './change_detection/change_detection'; import {LOCALE_ID} from './i18n/tokens'; import {Compiler} from './linker/compiler'; -import {ComponentResolver} from './linker/component_resolver'; import {ViewUtils} from './linker/view_utils'; import {NgModule} from './metadata'; import {Type} from './type'; @@ -45,7 +44,6 @@ export const APPLICATION_COMMON_PROVIDERS: Array|{[k: string]: any}|an {provide: ApplicationRef, useExisting: ApplicationRef_}, ApplicationInitStatus, Compiler, - {provide: ComponentResolver, useExisting: Compiler}, APP_ID_RANDOM_PROVIDER, ViewUtils, {provide: IterableDiffers, useFactory: _iterableDiffersFactory}, diff --git a/modules/@angular/core/src/linker.ts b/modules/@angular/core/src/linker.ts index 642e7df076..28f3441758 100644 --- a/modules/@angular/core/src/linker.ts +++ b/modules/@angular/core/src/linker.ts @@ -10,7 +10,6 @@ export {COMPILER_OPTIONS, Compiler, CompilerFactory, CompilerOptions, ComponentStillLoadingError, ModuleWithComponentFactories} from './linker/compiler'; export {ComponentFactory, ComponentRef} from './linker/component_factory'; export {ComponentFactoryResolver, NoComponentFactoryError} from './linker/component_factory_resolver'; -export {ComponentResolver} from './linker/component_resolver'; export {ElementRef} from './linker/element_ref'; export {ExpressionChangedAfterItHasBeenCheckedException} from './linker/exceptions'; export {NgModuleFactory, NgModuleRef} from './linker/ng_module_factory'; diff --git a/modules/@angular/core/src/linker/component_resolver.ts b/modules/@angular/core/src/linker/component_resolver.ts deleted file mode 100644 index f1aa2260ee..0000000000 --- a/modules/@angular/core/src/linker/component_resolver.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {Type} from '../type'; -import {ComponentFactory} from './component_factory'; - -/** - * Low-level service for loading {@link ComponentFactory}s, which - * can later be used to create and render a Component instance. - * - * @deprecated Use {@link ComponentFactoryResolver} together with {@link - * NgModule}.entryComponents}/{@link Component}.entryComponents or - * {@link ANALYZE_FOR_ENTRY_COMPONENTS} provider for dynamic component creation. - * Use {@link NgModuleFactoryLoader} for lazy loading. - */ -export abstract class ComponentResolver { - static DynamicCompilationDeprecationMsg = - 'ComponentResolver is deprecated for dynamic compilation. Use ComponentFactoryResolver together with @NgModule/@Component.entryComponents or ANALYZE_FOR_ENTRY_COMPONENTS provider instead. For runtime compile only, you can also use Compiler.compileComponentSync/Async.'; - static LazyLoadingDeprecationMsg = - 'ComponentResolver is deprecated for lazy loading. Use NgModuleFactoryLoader instead.'; - - - abstract resolveComponent(component: Type|string): Promise>; - abstract clearCache(): void; -} diff --git a/modules/@angular/core/src/linker/view_container_ref.ts b/modules/@angular/core/src/linker/view_container_ref.ts index 1c42bb66eb..d32e046765 100644 --- a/modules/@angular/core/src/linker/view_container_ref.ts +++ b/modules/@angular/core/src/linker/view_container_ref.ts @@ -78,7 +78,7 @@ export abstract class ViewContainerRef { * specified `index`. * * The component is instantiated using its {@link ComponentFactory} which can be - * obtained via {@link ComponentResolver#resolveComponent}. + * obtained via {@link ComponentFactoryResolver#resolveComponentFactory}. * * If `index` is not specified, the new View will be inserted as the last View in the container. * diff --git a/modules/@angular/core/test/linker/integration_spec.ts b/modules/@angular/core/test/linker/integration_spec.ts index e4e6ec92f0..4a8aeaa320 100644 --- a/modules/@angular/core/test/linker/integration_spec.ts +++ b/modules/@angular/core/test/linker/integration_spec.ts @@ -7,10 +7,9 @@ */ import {AsyncPipe, NgFor, NgIf} from '@angular/common'; -import {CompilerConfig} from '@angular/compiler'; -import {Compiler, Host, Inject, Injectable, Injector, OnDestroy, OpaqueToken, ReflectiveInjector, SkipSelf, SkipSelfMetadata, forwardRef} from '@angular/core'; +import {Compiler, Host, Inject, Injectable, Injector, NgModule, OnDestroy, OpaqueToken, ReflectiveInjector, SkipSelf, SkipSelfMetadata, forwardRef} from '@angular/core'; import {ChangeDetectionStrategy, ChangeDetectorRef, PipeTransform} from '@angular/core/src/change_detection/change_detection'; -import {ComponentResolver} from '@angular/core/src/linker/component_resolver'; +import {ComponentFactoryResolver} from '@angular/core/src/linker/component_factory_resolver'; import {ElementRef} from '@angular/core/src/linker/element_ref'; import {QueryList} from '@angular/core/src/linker/query_list'; import {TemplateRef, TemplateRef_} from '@angular/core/src/linker/template_ref'; @@ -19,7 +18,7 @@ import {EmbeddedViewRef} from '@angular/core/src/linker/view_ref'; import {Attribute, Component, ContentChildren, Directive, HostBinding, HostListener, Input, Output, Pipe} from '@angular/core/src/metadata'; import {ViewMetadata} from '@angular/core/src/metadata/view'; import {Renderer} from '@angular/core/src/render'; -import {ComponentFixture, TestBed, fakeAsync, tick} from '@angular/core/testing'; +import {ComponentFixture, TestBed, async, fakeAsync, tick} from '@angular/core/testing'; import {AsyncTestCompleter, TestComponentBuilder, beforeEach, beforeEachProviders, ddescribe, describe, iit, inject, it, xdescribe, xit} from '@angular/core/testing/testing_internal'; import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import {dispatchEvent, el} from '@angular/platform-browser/testing/browser_util'; @@ -1263,27 +1262,35 @@ function declareTests({useJit}: {useJit: boolean}) { })); describe('dynamic ViewContainers', () => { - it('should allow to create a ViewContainerRef at any bound location', - inject( - [TestComponentBuilder, AsyncTestCompleter, ComponentResolver], - (tcb: TestComponentBuilder, async: AsyncTestCompleter, - compiler: ComponentResolver) => { - tcb.overrideView(MyComp, new ViewMetadata({ - template: '
', - directives: [DynamicViewport] - })) - .createAsync(MyComp) - .then((fixture) => { - var tc = fixture.debugElement.children[0].children[0]; - var dynamicVp: DynamicViewport = tc.injector.get(DynamicViewport); - dynamicVp.done.then((_) => { - fixture.detectChanges(); - expect(fixture.debugElement.children[0].children[1].nativeElement) - .toHaveText('dynamic greet'); - async.done(); - }); - }); - })); + beforeEach(() => { + + // we need a module to declarate ChildCompUsingService as an entryComponent otherwise the + // factory doesn't get created + @NgModule({ + declarations: [DynamicViewport, MyComp, ChildCompUsingService], + entryComponents: [ChildCompUsingService, MyComp] + }) + class MyModule { + } + + + TestBed.configureTestingModule({imports: [MyModule]}); + TestBed.overrideComponent( + MyComp, {add: {template: '
'}}); + return TestBed.compileComponents(); + }); + + + it('should allow to create a ViewContainerRef at any bound location', async(() => { + var fixture = TestBed.createComponent(MyComp); + var tc = fixture.debugElement.children[0].children[0]; + var dynamicVp: DynamicViewport = tc.injector.get(DynamicViewport); + dynamicVp.done.then((_) => { + fixture.detectChanges(); + expect(fixture.debugElement.children[0].children[1].nativeElement) + .toHaveText('dynamic greet'); + }); + })); }); @@ -2135,14 +2142,15 @@ class SimpleImperativeViewComponent { @Directive({selector: 'dynamic-vp'}) class DynamicViewport { done: Promise; - constructor(vc: ViewContainerRef, compiler: ComponentResolver) { + constructor(vc: ViewContainerRef, componentFactoryResolver: ComponentFactoryResolver) { var myService = new MyService(); myService.greeting = 'dynamic greet'; var injector = ReflectiveInjector.resolveAndCreate( [{provide: MyService, useValue: myService}], vc.injector); - this.done = compiler.resolveComponent(ChildCompUsingService) - .then((componentFactory) => vc.createComponent(componentFactory, 0, injector)); + this.done = + Promise.resolve(componentFactoryResolver.resolveComponentFactory(ChildCompUsingService)) + .then((componentFactory) => vc.createComponent(componentFactory, 0, injector)); } } diff --git a/modules/@angular/core/test/linker/ng_module_integration_spec.ts b/modules/@angular/core/test/linker/ng_module_integration_spec.ts index fe57c7e324..27544f023f 100644 --- a/modules/@angular/core/test/linker/ng_module_integration_spec.ts +++ b/modules/@angular/core/test/linker/ng_module_integration_spec.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {ANALYZE_FOR_ENTRY_COMPONENTS, CUSTOM_ELEMENTS_SCHEMA, Compiler, Component, ComponentFactoryResolver, ComponentResolver, Directive, HostBinding, Inject, Injectable, Injector, Input, NgModule, NgModuleRef, Optional, Pipe, ReflectiveInjector, SelfMetadata, Type, forwardRef} from '@angular/core'; +import {ANALYZE_FOR_ENTRY_COMPONENTS, CUSTOM_ELEMENTS_SCHEMA, Compiler, Component, ComponentFactoryResolver, Directive, HostBinding, Inject, Injectable, Injector, Input, NgModule, NgModuleRef, Optional, Pipe, SelfMetadata, Type, forwardRef} from '@angular/core'; import {Console} from '@angular/core/src/console'; import {ComponentFixture, TestBed} from '@angular/core/testing'; import {AsyncTestCompleter, beforeEach, beforeEachProviders, ddescribe, describe, iit, inject, it, xdescribe, xit} from '@angular/core/testing/testing_internal'; @@ -628,47 +628,6 @@ function declareTests({useJit}: {useJit: boolean}) { // compile again should produce the same result expect(boundCompiler.compileComponentSync(CompUsingModuleDirectiveAndPipe)).toBe(cf); }); - - it('should provide a ComponentResolver instance that uses the directives/pipes of the module', - inject([AsyncTestCompleter], (async: AsyncTestCompleter) => { - - @NgModule({declarations: [SomeDirective, SomePipe]}) - class SomeModule { - } - - const ngModule = createModule(SomeModule); - - const boundCompiler: ComponentResolver = ngModule.injector.get(ComponentResolver); - boundCompiler.resolveComponent(CompUsingModuleDirectiveAndPipe).then((cf) => { - const compFixture = new ComponentFixture(cf.create(injector), null, false); - compFixture.detectChanges(); - expect(compFixture.debugElement.children[0].properties['title']) - .toBe('transformed someValue'); - async.done(); - }); - })); - - it('should provide a ComponentResolver instance that delegates to the parent ComponentResolver for strings', - inject([AsyncTestCompleter], (async: AsyncTestCompleter) => { - @NgModule() - class SomeModule { - } - - let parentResolver: any = - jasmine.createSpyObj('resolver', ['resolveComponent', 'clearCache']); - const ngModule = createModule( - SomeModule, ReflectiveInjector.resolveAndCreate( - [{provide: ComponentResolver, useValue: parentResolver}])); - parentResolver.resolveComponent.and.returnValue( - Promise.resolve('someFactoryFromParent')); - let boundCompiler: ComponentResolver = ngModule.injector.get(ComponentResolver); - boundCompiler.resolveComponent('someString').then((result) => { - expect(parentResolver.resolveComponent).toHaveBeenCalledWith('someString'); - expect(result).toBe('someFactoryFromParent'); - async.done(); - }); - })); - }); describe('providers', function() { diff --git a/modules/benchmarks/src/largetable/largetable_benchmark.ts b/modules/benchmarks/src/largetable/largetable_benchmark.ts index b4bdae3b2c..d4cbebc02b 100644 --- a/modules/benchmarks/src/largetable/largetable_benchmark.ts +++ b/modules/benchmarks/src/largetable/largetable_benchmark.ts @@ -9,7 +9,7 @@ import { } from '@angular/testing/src/benchmark_util'; import {bootstrap} from '@angular/platform-browser'; import {Component} from '@angular/core'; -import {NgFor, NgSwitch, NgSwitchWhen, NgSwitchDefault} from '@angular/common'; +import {NgFor, NgSwitch, NgSwitchCase, NgSwitchDefault} from '@angular/common'; import {ApplicationRef} from '@angular/core/src/application_ref'; import {BrowserDomAdapter} from '@angular/platform-browser/src/browser/browser_adapter'; @@ -37,12 +37,12 @@ function setupReflector() { reflector.registerGetters({ 'benchmarktype': (o) => o.benchmarktype, 'switch': (o) => null, - 'switchWhen': (o) => o.switchWhen + 'switchCase': (o) => o.switchCase }); reflector.registerSetters({ 'benchmarktype': (o, v) => o.benchmarktype = v, 'switch': (o, v) => null, - 'switchWhen': (o, v) => o.switchWhen = v + 'switchCase': (o, v) => o.switchCase = v }); } @@ -210,24 +210,24 @@ class CellData { @Component({ selector: 'largetable', inputs: ['data', 'benchmarkType'], - directives: [NgFor, NgSwitch, NgSwitchWhen, NgSwitchDefault], + directives: [NgFor, NgSwitch, NgSwitchCase, NgSwitchDefault], template: ` - + - + - +
{{column.i}}:{{column.j}}|
i,j attrs
{{column.iFn()}}:{{column.jFn()}}| diff --git a/tools/public_api_guard/common/index.d.ts b/tools/public_api_guard/common/index.d.ts index afa239dbc0..cda6c3eddd 100644 --- a/tools/public_api_guard/common/index.d.ts +++ b/tools/public_api_guard/common/index.d.ts @@ -164,7 +164,6 @@ export declare class NgSwitch { /** @experimental */ export declare class NgSwitchCase { ngSwitchCase: any; - ngSwitchWhen: any; constructor(viewContainer: ViewContainerRef, templateRef: TemplateRef, ngSwitch: NgSwitch); } diff --git a/tools/public_api_guard/core/index.d.ts b/tools/public_api_guard/core/index.d.ts index 0f341376de..851c297567 100644 --- a/tools/public_api_guard/core/index.d.ts +++ b/tools/public_api_guard/core/index.d.ts @@ -329,14 +329,6 @@ export declare abstract class ComponentRef { abstract onDestroy(callback: Function): void; } -/** @deprecated */ -export declare abstract class ComponentResolver { - abstract clearCache(): void; - abstract resolveComponent(component: Type | string): Promise>; - static DynamicCompilationDeprecationMsg: string; - static LazyLoadingDeprecationMsg: string; -} - /** @stable */ export declare class ComponentStillLoadingError extends BaseException { compType: Type;