refactor(core): type `ComponentRef`, `ComponentFactory` and `ComponentFixture` by the component type
BREAKING CHANGE: - `ComponetRef`, `ComponentFactory`, `ComponentFixture` now all require a type parameter with the component type. Closes #8361
This commit is contained in:
parent
4e2c68354e
commit
6a0cbb8a57
|
@ -121,7 +121,7 @@ export function browserPlatform(): PlatformRef {
|
|||
*/
|
||||
export function bootstrap(
|
||||
appComponentType: Type,
|
||||
customProviders?: Array<any /*Type | Provider | any[]*/>): Promise<ComponentRef> {
|
||||
customProviders?: Array<any /*Type | Provider | any[]*/>): Promise<ComponentRef<any>> {
|
||||
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
||||
var appInjector = ReflectiveInjector.resolveAndCreate(
|
||||
[BROWSER_APP_PROVIDERS, isPresent(customProviders) ? customProviders : []],
|
||||
|
|
|
@ -47,7 +47,7 @@ export function browserStaticPlatform(): PlatformRef {
|
|||
*/
|
||||
export function bootstrapStatic(appComponentType: Type,
|
||||
customProviders?: Array<any /*Type | Provider | any[]*/>,
|
||||
initReflector?: Function): Promise<ComponentRef> {
|
||||
initReflector?: Function): Promise<ComponentRef<any>> {
|
||||
if (isPresent(initReflector)) {
|
||||
initReflector();
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ PlatformRef workerAppPlatform(SendPort renderSendPort) {
|
|||
return platform;
|
||||
}
|
||||
|
||||
Future<ComponentRef> bootstrapApp(
|
||||
Future<ComponentRef<dynamic>> bootstrapApp(
|
||||
SendPort renderSendPort,
|
||||
Type appComponentType,
|
||||
[List<dynamic /*Type | Provider | any[]*/> customProviders]) {
|
||||
|
|
|
@ -44,7 +44,7 @@ export function workerAppPlatform(): PlatformRef {
|
|||
|
||||
export function bootstrapApp(
|
||||
appComponentType: Type,
|
||||
customProviders?: Array<any /*Type | Provider | any[]*/>): Promise<ComponentRef> {
|
||||
customProviders?: Array<any /*Type | Provider | any[]*/>): Promise<ComponentRef<any>> {
|
||||
var appInjector = ReflectiveInjector.resolveAndCreate(
|
||||
[WORKER_APP_APPLICATION, isPresent(customProviders) ? customProviders : []],
|
||||
workerAppPlatform().injector);
|
||||
|
|
|
@ -15,7 +15,7 @@ import {isPresent, isBlank} from 'angular2/src/facade/lang';
|
|||
|
||||
@Directive({selector: 'router-outlet'})
|
||||
export class RouterOutlet {
|
||||
private _loaded: ComponentRef;
|
||||
private _loaded: ComponentRef<any>;
|
||||
public outletMap: RouterOutletMap;
|
||||
|
||||
constructor(parentOutletMap: RouterOutletMap, private _location: ViewContainerRef,
|
||||
|
@ -32,8 +32,8 @@ export class RouterOutlet {
|
|||
|
||||
get isLoaded(): boolean { return isPresent(this._loaded); }
|
||||
|
||||
load(factory: ComponentFactory, providers: ResolvedReflectiveProvider[],
|
||||
outletMap: RouterOutletMap): ComponentRef {
|
||||
load(factory: ComponentFactory<any>, providers: ResolvedReflectiveProvider[],
|
||||
outletMap: RouterOutletMap): ComponentRef<any> {
|
||||
this.outletMap = outletMap;
|
||||
let inj = ReflectiveInjector.fromResolvedProviders(providers, this._location.parentInjector);
|
||||
this._loaded = this._location.createComponent(factory, this._location.length, inj, []);
|
||||
|
|
|
@ -86,10 +86,10 @@ export class RouteSegment {
|
|||
_type: Type;
|
||||
|
||||
/** @internal */
|
||||
_componentFactory: ComponentFactory;
|
||||
_componentFactory: ComponentFactory<any>;
|
||||
|
||||
constructor(public urlSegments: UrlSegment[], public parameters: {[key: string]: string},
|
||||
public outlet: string, type: Type, componentFactory: ComponentFactory) {
|
||||
public outlet: string, type: Type, componentFactory: ComponentFactory<any>) {
|
||||
this._type = type;
|
||||
this._componentFactory = componentFactory;
|
||||
}
|
||||
|
@ -123,6 +123,6 @@ export function equalSegments(a: RouteSegment, b: RouteSegment): boolean {
|
|||
return StringMapWrapper.equals(a.parameters, b.parameters);
|
||||
}
|
||||
|
||||
export function routeSegmentComponentFactory(a: RouteSegment): ComponentFactory {
|
||||
export function routeSegmentComponentFactory(a: RouteSegment): ComponentFactory<any> {
|
||||
return a._componentFactory;
|
||||
}
|
|
@ -61,17 +61,18 @@ export class OfflineCompiler {
|
|||
var hostMeta = createHostComponentMeta(compMeta.type, compMeta.selector);
|
||||
var hostViewFactoryVar = this._compileComponent(hostMeta, [compMeta], [], statements);
|
||||
var compFactoryVar = `${compMeta.type.name}NgFactory`;
|
||||
statements.push(o.variable(compFactoryVar)
|
||||
.set(o.importExpr(_COMPONENT_FACTORY_IDENTIFIER)
|
||||
.instantiate(
|
||||
[
|
||||
o.literal(compMeta.selector),
|
||||
o.variable(hostViewFactoryVar),
|
||||
o.importExpr(compMeta.type)
|
||||
],
|
||||
o.importType(_COMPONENT_FACTORY_IDENTIFIER, null,
|
||||
[o.TypeModifier.Const])))
|
||||
.toDeclStmt(null, [o.StmtModifier.Final]));
|
||||
statements.push(
|
||||
o.variable(compFactoryVar)
|
||||
.set(o.importExpr(_COMPONENT_FACTORY_IDENTIFIER, [o.importType(compMeta.type)])
|
||||
.instantiate(
|
||||
[
|
||||
o.literal(compMeta.selector),
|
||||
o.variable(hostViewFactoryVar),
|
||||
o.importExpr(compMeta.type)
|
||||
],
|
||||
o.importType(_COMPONENT_FACTORY_IDENTIFIER,
|
||||
[o.importType(compMeta.type)], [o.TypeModifier.Const])))
|
||||
.toDeclStmt(null, [o.StmtModifier.Final]));
|
||||
exportedVars.push(compFactoryVar);
|
||||
});
|
||||
return this._codegenSourceModule(moduleUrl, statements, exportedVars);
|
||||
|
|
|
@ -77,7 +77,7 @@ export class RuntimeCompiler implements ComponentResolver {
|
|||
private _viewCompiler: ViewCompiler, private _xhr: XHR,
|
||||
private _genConfig: CompilerConfig) {}
|
||||
|
||||
resolveComponent(componentType: Type): Promise<ComponentFactory> {
|
||||
resolveComponent(componentType: Type): Promise<ComponentFactory<any>> {
|
||||
var compMeta: CompileDirectiveMetadata =
|
||||
this._metadataResolver.getDirectiveMetadata(componentType);
|
||||
var hostCacheKey = this._hostCacheKeys.get(componentType);
|
||||
|
|
|
@ -94,8 +94,8 @@ export function getPlatform(): PlatformRef {
|
|||
* Shortcut for ApplicationRef.bootstrap.
|
||||
* Requires a platform the be created first.
|
||||
*/
|
||||
export function coreBootstrap(injector: Injector,
|
||||
componentFactory: ComponentFactory): ComponentRef {
|
||||
export function coreBootstrap<C>(injector: Injector,
|
||||
componentFactory: ComponentFactory<C>): ComponentRef<C> {
|
||||
var appRef: ApplicationRef = injector.get(ApplicationRef);
|
||||
return appRef.bootstrap(componentFactory);
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ export function coreBootstrap(injector: Injector,
|
|||
* Requires a platform the be created first.
|
||||
*/
|
||||
export function coreLoadAndBootstrap(injector: Injector,
|
||||
componentType: Type): Promise<ComponentRef> {
|
||||
componentType: Type): Promise<ComponentRef<any>> {
|
||||
var appRef: ApplicationRef = injector.get(ApplicationRef);
|
||||
return appRef.run(() => {
|
||||
var componentResolver: ComponentResolver = injector.get(ComponentResolver);
|
||||
|
@ -190,7 +190,7 @@ export abstract class ApplicationRef {
|
|||
* Register a listener to be called each time `bootstrap()` is called to bootstrap
|
||||
* a new root component.
|
||||
*/
|
||||
abstract registerBootstrapListener(listener: (ref: ComponentRef) => void): void;
|
||||
abstract registerBootstrapListener(listener: (ref: ComponentRef<any>) => void): void;
|
||||
|
||||
/**
|
||||
* Register a listener to be called when the application is disposed.
|
||||
|
@ -221,7 +221,7 @@ export abstract class ApplicationRef {
|
|||
* ### Example
|
||||
* {@example core/ts/platform/platform.ts region='longform'}
|
||||
*/
|
||||
abstract bootstrap(componentFactory: ComponentFactory): ComponentRef;
|
||||
abstract bootstrap<C>(componentFactory: ComponentFactory<C>): ComponentRef<C>;
|
||||
|
||||
/**
|
||||
* Retrieve the application {@link Injector}.
|
||||
|
@ -266,7 +266,7 @@ export class ApplicationRef_ extends ApplicationRef {
|
|||
/** @internal */
|
||||
private _disposeListeners: Function[] = [];
|
||||
/** @internal */
|
||||
private _rootComponents: ComponentRef[] = [];
|
||||
private _rootComponents: ComponentRef<any>[] = [];
|
||||
/** @internal */
|
||||
private _rootComponentTypes: Type[] = [];
|
||||
/** @internal */
|
||||
|
@ -315,7 +315,7 @@ export class ApplicationRef_ extends ApplicationRef {
|
|||
(_) => { this._zone.run(() => { this.tick(); }); });
|
||||
}
|
||||
|
||||
registerBootstrapListener(listener: (ref: ComponentRef) => void): void {
|
||||
registerBootstrapListener(listener: (ref: ComponentRef<any>) => void): void {
|
||||
this._bootstrapListeners.push(listener);
|
||||
}
|
||||
|
||||
|
@ -357,7 +357,7 @@ export class ApplicationRef_ extends ApplicationRef {
|
|||
return isPromise(result) ? completer.promise : result;
|
||||
}
|
||||
|
||||
bootstrap(componentFactory: ComponentFactory): ComponentRef {
|
||||
bootstrap<C>(componentFactory: ComponentFactory<C>): ComponentRef<C> {
|
||||
if (!this._asyncInitDone) {
|
||||
throw new BaseException(
|
||||
'Cannot bootstrap as there are still asynchronous initializers running. Wait for them using waitForAsyncInitializers().');
|
||||
|
@ -383,7 +383,7 @@ export class ApplicationRef_ extends ApplicationRef {
|
|||
}
|
||||
|
||||
/** @internal */
|
||||
_loadComponent(componentRef: ComponentRef): void {
|
||||
_loadComponent(componentRef: ComponentRef<any>): void {
|
||||
this._changeDetectorRefs.push(componentRef.changeDetectorRef);
|
||||
this.tick();
|
||||
this._rootComponents.push(componentRef);
|
||||
|
@ -391,7 +391,7 @@ export class ApplicationRef_ extends ApplicationRef {
|
|||
}
|
||||
|
||||
/** @internal */
|
||||
_unloadComponent(componentRef: ComponentRef): void {
|
||||
_unloadComponent(componentRef: ComponentRef<any>): void {
|
||||
if (!ListWrapper.contains(this._rootComponents, componentRef)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import {ChangeDetectorRef} from '../change_detection/change_detection';
|
|||
* Component Instance and allows you to destroy the Component Instance via the {@link #destroy}
|
||||
* method.
|
||||
*/
|
||||
export abstract class ComponentRef {
|
||||
export abstract class ComponentRef<C> {
|
||||
/**
|
||||
* Location of the Host Element of this Component Instance.
|
||||
*/
|
||||
|
@ -28,7 +28,7 @@ export abstract class ComponentRef {
|
|||
/**
|
||||
* The instance of the Component.
|
||||
*/
|
||||
get instance(): any { return unimplemented(); };
|
||||
get instance(): C { return unimplemented(); };
|
||||
|
||||
/**
|
||||
* The {@link ViewRef} of the Host View of this Component instance.
|
||||
|
@ -56,11 +56,11 @@ export abstract class ComponentRef {
|
|||
abstract onDestroy(callback: Function): void;
|
||||
}
|
||||
|
||||
export class ComponentRef_ extends ComponentRef {
|
||||
export class ComponentRef_<C> extends ComponentRef<C> {
|
||||
constructor(private _hostElement: AppElement, private _componentType: Type) { super(); }
|
||||
get location(): ElementRef { return this._hostElement.elementRef; }
|
||||
get injector(): Injector { return this._hostElement.injector; }
|
||||
get instance(): any { return this._hostElement.component; };
|
||||
get instance(): C { return this._hostElement.component; };
|
||||
get hostView(): ViewRef { return this._hostElement.parentView.ref; };
|
||||
get changeDetectorRef(): ChangeDetectorRef { return this._hostElement.parentView.ref; };
|
||||
get componentType(): Type { return this._componentType; }
|
||||
|
@ -72,7 +72,7 @@ export class ComponentRef_ extends ComponentRef {
|
|||
const EMPTY_CONTEXT = /*@ts2dart_const*/ new Object();
|
||||
|
||||
/*@ts2dart_const*/
|
||||
export class ComponentFactory {
|
||||
export class ComponentFactory<C> {
|
||||
constructor(public selector: string, private _viewFactory: Function,
|
||||
private _componentType: Type) {}
|
||||
|
||||
|
@ -82,7 +82,7 @@ export class ComponentFactory {
|
|||
* Creates a new component.
|
||||
*/
|
||||
create(injector: Injector, projectableNodes: any[][] = null,
|
||||
rootSelectorOrNode: string | any = null): ComponentRef {
|
||||
rootSelectorOrNode: string | any = null): ComponentRef<C> {
|
||||
var vu: ViewUtils = injector.get(ViewUtils);
|
||||
if (isBlank(projectableNodes)) {
|
||||
projectableNodes = [];
|
||||
|
@ -90,6 +90,6 @@ export class ComponentFactory {
|
|||
// Note: Host views don't need a declarationAppElement!
|
||||
var hostView = this._viewFactory(vu, injector, null);
|
||||
var hostElement = hostView.create(EMPTY_CONTEXT, projectableNodes, rootSelectorOrNode);
|
||||
return new ComponentRef_(hostElement, this._componentType);
|
||||
return new ComponentRef_<C>(hostElement, this._componentType);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import {ComponentFactory} from './component_factory';
|
|||
* can later be used to create and render a Component instance.
|
||||
*/
|
||||
export abstract class ComponentResolver {
|
||||
abstract resolveComponent(componentType: Type): Promise<ComponentFactory>;
|
||||
abstract resolveComponent(componentType: Type): Promise<ComponentFactory<any>>;
|
||||
abstract clearCache();
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ function _isComponentFactory(type: any): boolean {
|
|||
|
||||
@Injectable()
|
||||
export class ReflectorComponentResolver extends ComponentResolver {
|
||||
resolveComponent(componentType: Type): Promise<ComponentFactory> {
|
||||
resolveComponent(componentType: Type): Promise<ComponentFactory<any>> {
|
||||
var metadatas = reflector.annotations(componentType);
|
||||
var componentFactory = metadatas.find(_isComponentFactory);
|
||||
|
||||
|
|
|
@ -65,7 +65,8 @@ export abstract class DynamicComponentLoader {
|
|||
* ```
|
||||
*/
|
||||
abstract loadAsRoot(type: Type, overrideSelectorOrNode: string | any, injector: Injector,
|
||||
onDispose?: () => void, projectableNodes?: any[][]): Promise<ComponentRef>;
|
||||
onDispose?: () => void,
|
||||
projectableNodes?: any[][]): Promise<ComponentRef<any>>;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -110,7 +111,7 @@ export abstract class DynamicComponentLoader {
|
|||
*/
|
||||
abstract loadNextToLocation(type: Type, location: ViewContainerRef,
|
||||
providers?: ResolvedReflectiveProvider[],
|
||||
projectableNodes?: any[][]): Promise<ComponentRef>;
|
||||
projectableNodes?: any[][]): Promise<ComponentRef<any>>;
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
|
@ -118,7 +119,7 @@ export class DynamicComponentLoader_ extends DynamicComponentLoader {
|
|||
constructor(private _compiler: ComponentResolver) { super(); }
|
||||
|
||||
loadAsRoot(type: Type, overrideSelectorOrNode: string | any, injector: Injector,
|
||||
onDispose?: () => void, projectableNodes?: any[][]): Promise<ComponentRef> {
|
||||
onDispose?: () => void, projectableNodes?: any[][]): Promise<ComponentRef<any>> {
|
||||
return this._compiler.resolveComponent(type).then(componentFactory => {
|
||||
var componentRef = componentFactory.create(
|
||||
injector, projectableNodes,
|
||||
|
@ -132,7 +133,7 @@ export class DynamicComponentLoader_ extends DynamicComponentLoader {
|
|||
|
||||
loadNextToLocation(type: Type, location: ViewContainerRef,
|
||||
providers: ResolvedReflectiveProvider[] = null,
|
||||
projectableNodes: any[][] = null): Promise<ComponentRef> {
|
||||
projectableNodes: any[][] = null): Promise<ComponentRef<any>> {
|
||||
return this._compiler.resolveComponent(type).then(componentFactory => {
|
||||
var contextInjector = location.parentInjector;
|
||||
var childInjector = isPresent(providers) && providers.length > 0 ?
|
||||
|
|
|
@ -62,9 +62,8 @@ export abstract class ViewContainerRef {
|
|||
*
|
||||
* Returns the {@link ViewRef} for the newly created View.
|
||||
*/
|
||||
// TODO(tbosch): Use a generic once ts2dart supports it.
|
||||
abstract createEmbeddedView(templateRef: TemplateRef<any>, context?: any,
|
||||
index?: number): EmbeddedViewRef<any>;
|
||||
abstract createEmbeddedView<C>(templateRef: TemplateRef<C>, context?: C,
|
||||
index?: number): EmbeddedViewRef<C>;
|
||||
|
||||
/**
|
||||
* Instantiates a single {@link Component} and inserts its Host View into this container at the
|
||||
|
@ -79,8 +78,8 @@ export abstract class ViewContainerRef {
|
|||
*
|
||||
* Returns the {@link ComponentRef} of the Host View created for the newly instantiated Component.
|
||||
*/
|
||||
abstract createComponent(componentFactory: ComponentFactory, index?: number, injector?: Injector,
|
||||
projectableNodes?: any[][]): ComponentRef;
|
||||
abstract createComponent<C>(componentFactory: ComponentFactory<C>, index?: number,
|
||||
injector?: Injector, projectableNodes?: any[][]): ComponentRef<C>;
|
||||
|
||||
/**
|
||||
* Inserts a View identified by a {@link ViewRef} into the container at the specified `index`.
|
||||
|
@ -129,9 +128,8 @@ export class ViewContainerRef_ implements ViewContainerRef {
|
|||
|
||||
// TODO(rado): profile and decide whether bounds checks should be added
|
||||
// to the methods below.
|
||||
// TODO(tbosch): use a generic C once ts2dart supports it.
|
||||
createEmbeddedView(templateRef: TemplateRef<any>, context: any = null,
|
||||
index: number = -1): EmbeddedViewRef<any> {
|
||||
createEmbeddedView<C>(templateRef: TemplateRef<C>, context: C = null,
|
||||
index: number = -1): EmbeddedViewRef<C> {
|
||||
var viewRef: EmbeddedViewRef<any> = templateRef.createEmbeddedView(context);
|
||||
this.insert(viewRef, index);
|
||||
return viewRef;
|
||||
|
@ -141,8 +139,8 @@ export class ViewContainerRef_ implements ViewContainerRef {
|
|||
_createComponentInContainerScope: WtfScopeFn =
|
||||
wtfCreateScope('ViewContainerRef#createComponent()');
|
||||
|
||||
createComponent(componentFactory: ComponentFactory, index: number = -1, injector: Injector = null,
|
||||
projectableNodes: any[][] = null): ComponentRef {
|
||||
createComponent<C>(componentFactory: ComponentFactory<C>, index: number = -1,
|
||||
injector: Injector = null, projectableNodes: any[][] = null): ComponentRef<C> {
|
||||
var s = this._createComponentInContainerScope();
|
||||
var contextInjector = isPresent(injector) ? injector : this._element.parentInjector;
|
||||
var componentRef = componentFactory.create(contextInjector, projectableNodes);
|
||||
|
|
|
@ -9,11 +9,11 @@ import {NgZone} from 'angular2/src/core/zone/ng_zone';
|
|||
*/
|
||||
@Injectable()
|
||||
export class MockApplicationRef extends ApplicationRef {
|
||||
registerBootstrapListener(listener: (ref: ComponentRef) => void): void {}
|
||||
registerBootstrapListener(listener: (ref: ComponentRef<any>) => void): void {}
|
||||
|
||||
registerDisposeListener(dispose: () => void): void {}
|
||||
|
||||
bootstrap(componentFactory: ComponentFactory): ComponentRef { return null; }
|
||||
bootstrap<C>(componentFactory: ComponentFactory<C>): ComponentRef<C> { return null; }
|
||||
|
||||
get injector(): Injector { return null; };
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ export class ChangeDetectionPerfRecord {
|
|||
export class AngularTools {
|
||||
profiler: AngularProfiler;
|
||||
|
||||
constructor(ref: ComponentRef) { this.profiler = new AngularProfiler(ref); }
|
||||
constructor(ref: ComponentRef<any>) { this.profiler = new AngularProfiler(ref); }
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -25,7 +25,7 @@ export class AngularTools {
|
|||
export class AngularProfiler {
|
||||
appRef: ApplicationRef;
|
||||
|
||||
constructor(ref: ComponentRef) { this.appRef = ref.injector.get(ApplicationRef); }
|
||||
constructor(ref: ComponentRef<any>) { this.appRef = ref.injector.get(ApplicationRef); }
|
||||
|
||||
/**
|
||||
* Exercises change detection in a loop and then prints the average amount of
|
||||
|
|
|
@ -16,7 +16,7 @@ import 'common_tools.dart' show AngularTools;
|
|||
* 1. Try the change detection profiler `ng.profiler.timeChangeDetection()`
|
||||
* then hit Enter.
|
||||
*/
|
||||
void enableDebugTools(ComponentRef ref) {
|
||||
void enableDebugTools(ComponentRef<dynamic> ref) {
|
||||
final tools = new AngularTools(ref);
|
||||
context['ng'] = new JsObject.jsify({
|
||||
'profiler': {
|
||||
|
|
|
@ -15,7 +15,7 @@ var context = <any>global;
|
|||
* 1. Try the change detection profiler `ng.profiler.timeChangeDetection()`
|
||||
* then hit Enter.
|
||||
*/
|
||||
export function enableDebugTools(ref: ComponentRef): void {
|
||||
export function enableDebugTools(ref: ComponentRef<any>): void {
|
||||
context.ng = new AngularTools(ref);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ let _resolveToTrue = PromiseWrapper.resolve(true);
|
|||
@Directive({selector: 'router-outlet'})
|
||||
export class RouterOutlet implements OnDestroy {
|
||||
name: string = null;
|
||||
private _componentRef: Promise<ComponentRef> = null;
|
||||
private _componentRef: Promise<ComponentRef<any>> = null;
|
||||
private _currentInstruction: ComponentInstruction = null;
|
||||
|
||||
@Output('activate') public activateEvents = new EventEmitter<any>();
|
||||
|
@ -70,7 +70,7 @@ export class RouterOutlet implements OnDestroy {
|
|||
this.activateEvents.emit(componentRef.instance);
|
||||
if (hasLifecycleHook(hookMod.routerOnActivate, componentType)) {
|
||||
return this._componentRef.then(
|
||||
(ref: ComponentRef) =>
|
||||
(ref: ComponentRef<any>) =>
|
||||
(<OnActivate>ref.instance).routerOnActivate(nextInstruction, previousInstruction));
|
||||
} else {
|
||||
return componentRef;
|
||||
|
@ -96,7 +96,7 @@ export class RouterOutlet implements OnDestroy {
|
|||
return PromiseWrapper.resolve(
|
||||
hasLifecycleHook(hookMod.routerOnReuse, this._currentInstruction.componentType) ?
|
||||
this._componentRef.then(
|
||||
(ref: ComponentRef) =>
|
||||
(ref: ComponentRef<any>) =>
|
||||
(<OnReuse>ref.instance).routerOnReuse(nextInstruction, previousInstruction)) :
|
||||
true);
|
||||
}
|
||||
|
@ -111,13 +111,13 @@ export class RouterOutlet implements OnDestroy {
|
|||
if (isPresent(this._componentRef) && isPresent(this._currentInstruction) &&
|
||||
hasLifecycleHook(hookMod.routerOnDeactivate, this._currentInstruction.componentType)) {
|
||||
next = this._componentRef.then(
|
||||
(ref: ComponentRef) =>
|
||||
(ref: ComponentRef<any>) =>
|
||||
(<OnDeactivate>ref.instance)
|
||||
.routerOnDeactivate(nextInstruction, this._currentInstruction));
|
||||
}
|
||||
return next.then((_) => {
|
||||
if (isPresent(this._componentRef)) {
|
||||
var onDispose = this._componentRef.then((ref: ComponentRef) => ref.destroy());
|
||||
var onDispose = this._componentRef.then((ref: ComponentRef<any>) => ref.destroy());
|
||||
this._componentRef = null;
|
||||
return onDispose;
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ export class RouterOutlet implements OnDestroy {
|
|||
}
|
||||
if (hasLifecycleHook(hookMod.routerCanDeactivate, this._currentInstruction.componentType)) {
|
||||
return this._componentRef.then(
|
||||
(ref: ComponentRef) =>
|
||||
(ref: ComponentRef<any>) =>
|
||||
(<CanDeactivate>ref.instance)
|
||||
.routerCanDeactivate(nextInstruction, this._currentInstruction));
|
||||
} else {
|
||||
|
@ -164,7 +164,7 @@ export class RouterOutlet implements OnDestroy {
|
|||
result = false;
|
||||
} else if (hasLifecycleHook(hookMod.routerCanReuse, this._currentInstruction.componentType)) {
|
||||
result = this._componentRef.then(
|
||||
(ref: ComponentRef) =>
|
||||
(ref: ComponentRef<any>) =>
|
||||
(<CanReuse>ref.instance).routerCanReuse(nextInstruction, this._currentInstruction));
|
||||
} else {
|
||||
result = nextInstruction == this._currentInstruction ||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import {
|
||||
OpaqueToken,
|
||||
ComponentRef,
|
||||
DynamicComponentLoader,
|
||||
ComponentFactory,
|
||||
ComponentResolver,
|
||||
Injector,
|
||||
Injectable,
|
||||
ViewMetadata,
|
||||
|
@ -34,7 +35,7 @@ export var ComponentFixtureNoNgZone = new OpaqueToken("ComponentFixtureNoNgZone"
|
|||
/**
|
||||
* Fixture for debugging and testing a component.
|
||||
*/
|
||||
export class ComponentFixture {
|
||||
export class ComponentFixture<T> {
|
||||
/**
|
||||
* The DebugElement associated with the root element of this component.
|
||||
*/
|
||||
|
@ -58,7 +59,7 @@ export class ComponentFixture {
|
|||
/**
|
||||
* The ComponentRef for the component
|
||||
*/
|
||||
componentRef: ComponentRef;
|
||||
componentRef: ComponentRef<T>;
|
||||
|
||||
/**
|
||||
* The ChangeDetectorRef for the component
|
||||
|
@ -79,7 +80,7 @@ export class ComponentFixture {
|
|||
private _onMicrotaskEmptySubscription = null;
|
||||
private _onErrorSubscription = null;
|
||||
|
||||
constructor(componentRef: ComponentRef, ngZone: NgZone, autoDetect: boolean) {
|
||||
constructor(componentRef: ComponentRef<T>, ngZone: NgZone, autoDetect: boolean) {
|
||||
this.changeDetectorRef = componentRef.changeDetectorRef;
|
||||
this.elementRef = componentRef.location;
|
||||
this.debugElement = <DebugElement>getDebugNode(this.elementRef.nativeElement);
|
||||
|
@ -334,15 +335,30 @@ export class TestComponentBuilder {
|
|||
return this.overrideViewProviders(type, providers);
|
||||
}
|
||||
|
||||
private _create<C>(ngZone: NgZone, componentFactory: ComponentFactory<C>): ComponentFixture<C> {
|
||||
let rootElId = `root${_nextRootElementId++}`;
|
||||
let rootEl = el(`<div id="${rootElId}"></div>`);
|
||||
let doc = this._injector.get(DOCUMENT);
|
||||
|
||||
// TODO(juliemr): can/should this be optional?
|
||||
let oldRoots = DOM.querySelectorAll(doc, '[id^=root]');
|
||||
for (let i = 0; i < oldRoots.length; i++) {
|
||||
DOM.remove(oldRoots[i]);
|
||||
}
|
||||
DOM.appendChild(doc.body, rootEl);
|
||||
var componentRef = componentFactory.create(this._injector, [], `#${rootElId}`);
|
||||
let autoDetect: boolean = this._injector.get(ComponentFixtureAutoDetect, false);
|
||||
return new ComponentFixture<any /*C*/>(componentRef, ngZone, autoDetect);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds and returns a ComponentFixture.
|
||||
*
|
||||
* @return {Promise<ComponentFixture>}
|
||||
*/
|
||||
createAsync(rootComponentType: Type): Promise<ComponentFixture> {
|
||||
createAsync(rootComponentType: Type): Promise<ComponentFixture<any>> {
|
||||
let noNgZone = IS_DART || this._injector.get(ComponentFixtureNoNgZone, false);
|
||||
let ngZone: NgZone = noNgZone ? null : this._injector.get(NgZone, null);
|
||||
let autoDetect: boolean = this._injector.get(ComponentFixtureAutoDetect, false);
|
||||
|
||||
let initComponent = () => {
|
||||
let mockDirectiveResolver = this._injector.get(DirectiveResolver);
|
||||
|
@ -359,28 +375,15 @@ export class TestComponentBuilder {
|
|||
this._viewBindingsOverrides.forEach(
|
||||
(bindings, type) => mockDirectiveResolver.setViewBindingsOverride(type, bindings));
|
||||
|
||||
let rootElId = `root${_nextRootElementId++}`;
|
||||
let rootEl = el(`<div id="${rootElId}"></div>`);
|
||||
let doc = this._injector.get(DOCUMENT);
|
||||
|
||||
// TODO(juliemr): can/should this be optional?
|
||||
let oldRoots = DOM.querySelectorAll(doc, '[id^=root]');
|
||||
for (let i = 0; i < oldRoots.length; i++) {
|
||||
DOM.remove(oldRoots[i]);
|
||||
}
|
||||
DOM.appendChild(doc.body, rootEl);
|
||||
|
||||
let promise: Promise<ComponentRef> =
|
||||
this._injector.get(DynamicComponentLoader)
|
||||
.loadAsRoot(rootComponentType, `#${rootElId}`, this._injector);
|
||||
return promise.then(
|
||||
(componentRef) => { return new ComponentFixture(componentRef, ngZone, autoDetect); });
|
||||
let promise: Promise<ComponentFactory<any>> =
|
||||
this._injector.get(ComponentResolver).resolveComponent(rootComponentType);
|
||||
return promise.then(componentFactory => this._create(ngZone, componentFactory));
|
||||
};
|
||||
|
||||
return ngZone == null ? initComponent() : ngZone.run(initComponent);
|
||||
}
|
||||
|
||||
createFakeAsync(rootComponentType: Type): ComponentFixture {
|
||||
createFakeAsync(rootComponentType: Type): ComponentFixture<any> {
|
||||
let result;
|
||||
let error;
|
||||
PromiseWrapper.then(this.createAsync(rootComponentType), (_result) => { result = _result; },
|
||||
|
@ -391,4 +394,12 @@ export class TestComponentBuilder {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
createSync<C>(componentFactory: ComponentFactory<C>): ComponentFixture<C> {
|
||||
let noNgZone = IS_DART || this._injector.get(ComponentFixtureNoNgZone, false);
|
||||
let ngZone: NgZone = noNgZone ? null : this._injector.get(NgZone, null);
|
||||
|
||||
let initComponent = () => this._create(ngZone, componentFactory);
|
||||
return ngZone == null ? initComponent() : ngZone.run(initComponent);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ export class DowngradeNg2ComponentAdapter {
|
|||
component: any = null;
|
||||
inputChangeCount: number = 0;
|
||||
inputChanges: {[key: string]: SimpleChange} = null;
|
||||
componentRef: ComponentRef = null;
|
||||
componentRef: ComponentRef<any> = null;
|
||||
changeDetector: ChangeDetectorRef = null;
|
||||
componentScope: angular.IScope;
|
||||
childNodes: Node[];
|
||||
|
@ -30,7 +30,8 @@ export class DowngradeNg2ComponentAdapter {
|
|||
constructor(private id: string, private info: ComponentInfo,
|
||||
private element: angular.IAugmentedJQuery, private attrs: angular.IAttributes,
|
||||
private scope: angular.IScope, private parentInjector: Injector,
|
||||
private parse: angular.IParseService, private componentFactory: ComponentFactory) {
|
||||
private parse: angular.IParseService,
|
||||
private componentFactory: ComponentFactory<any>) {
|
||||
(<any>this.element[0]).id = id;
|
||||
this.componentScope = scope.$new();
|
||||
this.childNodes = <Node[]><any>element.contents();
|
||||
|
|
|
@ -524,12 +524,12 @@ export class UpgradeAdapter {
|
|||
private compileNg2Components(compiler: ComponentResolver,
|
||||
componentFactoryRefMap: ComponentFactoryRefMap):
|
||||
Promise<ComponentFactoryRefMap> {
|
||||
var promises: Array<Promise<ComponentFactory>> = [];
|
||||
var promises: Array<Promise<ComponentFactory<any>>> = [];
|
||||
var types = this.upgradedComponents;
|
||||
for (var i = 0; i < types.length; i++) {
|
||||
promises.push(compiler.resolveComponent(types[i]));
|
||||
}
|
||||
return Promise.all(promises).then((componentFactories: Array<ComponentFactory>) => {
|
||||
return Promise.all(promises).then((componentFactories: Array<ComponentFactory<any>>) => {
|
||||
var types = this.upgradedComponents;
|
||||
for (var i = 0; i < componentFactories.length; i++) {
|
||||
componentFactoryRefMap[getComponentInfo(types[i]).selector] = componentFactories[i];
|
||||
|
@ -540,14 +540,14 @@ export class UpgradeAdapter {
|
|||
}
|
||||
|
||||
interface ComponentFactoryRefMap {
|
||||
[selector: string]: ComponentFactory;
|
||||
[selector: string]: ComponentFactory<any>;
|
||||
}
|
||||
|
||||
function ng1ComponentDirective(info: ComponentInfo, idPrefix: string): Function {
|
||||
(<any>directiveFactory).$inject = [NG2_COMPONENT_FACTORY_REF_MAP, NG1_PARSE];
|
||||
function directiveFactory(componentFactoryRefMap: ComponentFactoryRefMap,
|
||||
parse: angular.IParseService): angular.IDirective {
|
||||
var componentFactory: ComponentFactory = componentFactoryRefMap[info.selector];
|
||||
var componentFactory: ComponentFactory<any> = componentFactoryRefMap[info.selector];
|
||||
if (!componentFactory) throw new Error('Expecting ComponentFactory for: ' + info.selector);
|
||||
var idCount = 0;
|
||||
return {
|
||||
|
|
|
@ -213,12 +213,12 @@ export function main() {
|
|||
});
|
||||
}
|
||||
|
||||
function advance(fixture: ComponentFixture): void {
|
||||
function advance(fixture: ComponentFixture<any>): void {
|
||||
tick();
|
||||
fixture.detectChanges();
|
||||
}
|
||||
|
||||
function compileRoot(tcb: TestComponentBuilder): Promise<ComponentFixture> {
|
||||
function compileRoot(tcb: TestComponentBuilder): Promise<ComponentFixture<any>> {
|
||||
return tcb.createAsync(RootCmp);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import {Component, provide} from 'angular2/core';
|
|||
import {NgFor} from 'angular2/common';
|
||||
import {NgClass} from 'angular2/src/common/directives/ng_class';
|
||||
|
||||
function detectChangesAndCheck(fixture: ComponentFixture, classes: string) {
|
||||
function detectChangesAndCheck(fixture: ComponentFixture<any>, classes: string) {
|
||||
fixture.detectChanges();
|
||||
expect(fixture.debugElement.children[0].nativeElement.className).toEqual(classes);
|
||||
}
|
||||
|
|
|
@ -132,9 +132,7 @@ export function main() {
|
|||
<span>{{name}}</span>
|
||||
</div>`;
|
||||
|
||||
var fixture: ComponentFixture;
|
||||
|
||||
tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((root) => { fixture = root; });
|
||||
let fixture = tcb.overrideTemplate(MyComp, t).createFakeAsync(MyComp);
|
||||
tick();
|
||||
|
||||
fixture.debugElement.componentInstance.form = new ControlGroup({});
|
||||
|
@ -928,8 +926,7 @@ export function main() {
|
|||
var t =
|
||||
`<div [ngFormModel]="form"><input type="text" ngControl="name" [(ngModel)]="name"></div>`;
|
||||
|
||||
var fixture: ComponentFixture;
|
||||
tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((root) => { fixture = root; });
|
||||
let fixture = tcb.overrideTemplate(MyComp, t).createFakeAsync(MyComp);
|
||||
tick();
|
||||
|
||||
fixture.debugElement.componentInstance.name = 'oldValue';
|
||||
|
@ -952,8 +949,7 @@ export function main() {
|
|||
|
||||
var t = `<div><input type="text" [ngFormControl]="form" [(ngModel)]="name"></div>`;
|
||||
|
||||
var fixture: ComponentFixture;
|
||||
tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((root) => { fixture = root; });
|
||||
let fixture = tcb.overrideTemplate(MyComp, t).createFakeAsync(MyComp);
|
||||
tick();
|
||||
fixture.debugElement.componentInstance.form = form;
|
||||
fixture.debugElement.componentInstance.name = "oldValue";
|
||||
|
@ -978,8 +974,7 @@ export function main() {
|
|||
</div>
|
||||
</form>`;
|
||||
|
||||
var fixture: ComponentFixture;
|
||||
tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((root) => { fixture = root; });
|
||||
let fixture = tcb.overrideTemplate(MyComp, t).createFakeAsync(MyComp);
|
||||
tick();
|
||||
fixture.debugElement.componentInstance.name = null;
|
||||
fixture.detectChanges();
|
||||
|
@ -997,8 +992,7 @@ export function main() {
|
|||
fakeAsync(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
var t = `<div><form (ngSubmit)="name='updated'"></form></div>`;
|
||||
|
||||
var fixture: ComponentFixture;
|
||||
tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((root) => { fixture = root; });
|
||||
let fixture = tcb.overrideTemplate(MyComp, t).createFakeAsync(MyComp);
|
||||
tick();
|
||||
fixture.debugElement.componentInstance.name = 'old';
|
||||
var form = fixture.debugElement.query(By.css("form"));
|
||||
|
@ -1031,8 +1025,7 @@ export function main() {
|
|||
</div>
|
||||
</form>`;
|
||||
|
||||
var fixture: ComponentFixture;
|
||||
tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((root) => { fixture = root; });
|
||||
let fixture = tcb.overrideTemplate(MyComp, t).createFakeAsync(MyComp);
|
||||
tick();
|
||||
fixture.debugElement.componentInstance.name = 'show';
|
||||
fixture.detectChanges();
|
||||
|
@ -1058,8 +1051,7 @@ export function main() {
|
|||
</form>`;
|
||||
|
||||
|
||||
var fixture: ComponentFixture;
|
||||
tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((root) => { fixture = root; });
|
||||
let fixture = tcb.overrideTemplate(MyComp, t).createFakeAsync(MyComp);
|
||||
tick();
|
||||
fixture.debugElement.componentInstance.name = 'show';
|
||||
fixture.detectChanges();
|
||||
|
@ -1081,8 +1073,7 @@ export function main() {
|
|||
<input type="text" ngControl="name" [(ngModel)]="name">
|
||||
</form>`;
|
||||
|
||||
var fixture: ComponentFixture;
|
||||
tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((root) => { fixture = root; });
|
||||
let fixture = tcb.overrideTemplate(MyComp, t).createFakeAsync(MyComp);
|
||||
tick();
|
||||
fixture.debugElement.componentInstance.name = "oldValue";
|
||||
fixture.detectChanges();
|
||||
|
@ -1103,8 +1094,7 @@ export function main() {
|
|||
fakeAsync(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
var t = `<div><input type="text" [(ngModel)]="name"></div>`;
|
||||
|
||||
var fixture: ComponentFixture;
|
||||
tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((root) => { fixture = root; });
|
||||
let fixture = tcb.overrideTemplate(MyComp, t).createFakeAsync(MyComp);
|
||||
tick();
|
||||
fixture.debugElement.componentInstance.name = "oldValue";
|
||||
fixture.detectChanges();
|
||||
|
@ -1131,8 +1121,7 @@ export function main() {
|
|||
<input type="radio" name="food" ngControl="fish" [(ngModel)]="data['fish2']">
|
||||
</form>`;
|
||||
|
||||
var fixture: ComponentFixture;
|
||||
tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((f) => { fixture = f; });
|
||||
let fixture = tcb.overrideTemplate(MyComp, t).createFakeAsync(MyComp);
|
||||
tick();
|
||||
|
||||
fixture.debugElement.componentInstance.data = {
|
||||
|
@ -1248,8 +1237,7 @@ export function main() {
|
|||
var form = new Control("");
|
||||
|
||||
var t = `<div><input type="text" [ngFormControl]="form" [(ngModel)]="name"></div>`;
|
||||
var fixture: ComponentFixture;
|
||||
tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((root) => { fixture = root; });
|
||||
let fixture = tcb.overrideTemplate(MyComp, t).createFakeAsync(MyComp);
|
||||
tick();
|
||||
fixture.debugElement.componentInstance.form = form;
|
||||
fixture.detectChanges();
|
||||
|
@ -1276,8 +1264,7 @@ export function main() {
|
|||
it("should update the view when the model is set back to what used to be in the view",
|
||||
fakeAsync(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
var t = `<input type="text" [(ngModel)]="name">`;
|
||||
var fixture: ComponentFixture;
|
||||
tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((root) => { fixture = root; });
|
||||
let fixture = tcb.overrideTemplate(MyComp, t).createFakeAsync(MyComp);
|
||||
tick();
|
||||
fixture.debugElement.componentInstance.name = "";
|
||||
fixture.detectChanges();
|
||||
|
@ -1311,8 +1298,7 @@ export function main() {
|
|||
// fixed.
|
||||
var t = `<form><div ngControlGroup="x" #x="ngForm">
|
||||
<input type="text" ngControl="test"></div>{{x.valid}}</form>`;
|
||||
var fixture: ComponentFixture;
|
||||
tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((root) => { fixture = root; });
|
||||
let fixture = tcb.overrideTemplate(MyComp, t).createFakeAsync(MyComp);
|
||||
tick();
|
||||
fixture.detectChanges();
|
||||
})));
|
||||
|
|
|
@ -4,8 +4,9 @@ import {TypeScriptEmitter} from 'angular2/src/compiler/output/ts_emitter';
|
|||
import {DartEmitter} from 'angular2/src/compiler/output/dart_emitter';
|
||||
import {compileComp, compAMetadata} from './offline_compiler_util';
|
||||
import {ComponentFactory} from 'angular2/src/core/linker/component_factory';
|
||||
import {CompA} from './offline_compiler_util';
|
||||
|
||||
export const CompANgFactory: ComponentFactory = null;
|
||||
export const CompANgFactory: ComponentFactory<CompA> = null;
|
||||
|
||||
// Generator
|
||||
export function main(args: string[]) {
|
||||
|
|
|
@ -3,8 +3,9 @@ import {print} from 'angular2/src/facade/lang';
|
|||
import {JavaScriptEmitter} from 'angular2/src/compiler/output/js_emitter';
|
||||
import {compileComp, compAMetadata} from './offline_compiler_util';
|
||||
import {ComponentFactory} from 'angular2/src/core/linker/component_factory';
|
||||
import {CompA} from './offline_compiler_util';
|
||||
|
||||
export const CompANgFactory: ComponentFactory = null;
|
||||
export const CompANgFactory: ComponentFactory<CompA> = null;
|
||||
|
||||
// Generator
|
||||
export function main(args: string[]) {
|
||||
|
|
|
@ -16,7 +16,6 @@ import {
|
|||
|
||||
import {IS_DART} from 'angular2/src/facade/lang';
|
||||
import {Injector} from 'angular2/core';
|
||||
import {DebugNode, DebugElement, getDebugNode} from 'angular2/src/core/debug/debug_node';
|
||||
|
||||
import {ComponentFactory} from 'angular2/src/core/linker/component_factory';
|
||||
import * as typed from './offline_compiler_codegen_typed';
|
||||
|
@ -28,18 +27,18 @@ import {SharedStylesHost} from "angular2/src/platform/dom/shared_styles_host";
|
|||
import {CompA} from './offline_compiler_util';
|
||||
|
||||
export function main() {
|
||||
var outputDefs = [];
|
||||
var typedComponentFactory = typed.CompANgFactory;
|
||||
var untypedComponentFactory = untyped.CompANgFactory;
|
||||
var fixtures: TestFixture[] = [];
|
||||
|
||||
if (IS_DART || !DOM.supportsDOMEvents()) {
|
||||
// Our generator only works on node.js and Dart...
|
||||
outputDefs.push({'compAHostComponentFactory': typedComponentFactory, 'name': 'typed'});
|
||||
fixtures.push(new TestFixture(typedComponentFactory, 'typed'));
|
||||
}
|
||||
if (!IS_DART) {
|
||||
// Our generator only works on node.js and Dart...
|
||||
if (!DOM.supportsDOMEvents()) {
|
||||
outputDefs.push({'compAHostComponentFactory': untypedComponentFactory, 'name': 'untyped'});
|
||||
fixtures.push(new TestFixture(untypedComponentFactory, 'untyped'));
|
||||
}
|
||||
}
|
||||
describe('OfflineCompiler', () => {
|
||||
|
@ -51,16 +50,11 @@ export function main() {
|
|||
sharedStylesHost = _sharedStylesHost;
|
||||
}));
|
||||
|
||||
function createHostComp(cf: ComponentFactory): DebugElement {
|
||||
var compRef = cf.create(injector);
|
||||
return <DebugElement>getDebugNode(compRef.location.nativeElement);
|
||||
}
|
||||
|
||||
outputDefs.forEach((outputDef) => {
|
||||
describe(`${outputDef['name']}`, () => {
|
||||
fixtures.forEach((fixture) => {
|
||||
describe(`${fixture.name}`, () => {
|
||||
it('should compile components', () => {
|
||||
var hostEl = createHostComp(outputDef['compAHostComponentFactory']);
|
||||
expect(hostEl.componentInstance).toBeAnInstanceOf(CompA);
|
||||
var hostEl = fixture.compFactory.create(injector);
|
||||
expect(hostEl.instance).toBeAnInstanceOf(CompA);
|
||||
var styles = sharedStylesHost.getAllStyles();
|
||||
expect(styles[0]).toContain('.redStyle[_ngcontent');
|
||||
expect(styles[1]).toContain('.greenStyle[_ngcontent');
|
||||
|
@ -68,4 +62,8 @@ export function main() {
|
|||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
class TestFixture {
|
||||
constructor(public compFactory: ComponentFactory<CompA>, public name: string) {}
|
||||
}
|
|
@ -50,7 +50,7 @@ export function main() {
|
|||
describe("bootstrap", () => {
|
||||
var platform: PlatformRef;
|
||||
var errorLogger: _ArrayLogger;
|
||||
var someCompFactory: ComponentFactory;
|
||||
var someCompFactory: ComponentFactory<any>;
|
||||
|
||||
beforeEach(() => {
|
||||
errorLogger = new _ArrayLogger();
|
||||
|
@ -153,24 +153,24 @@ class _ArrayLogger {
|
|||
logGroupEnd(){};
|
||||
}
|
||||
|
||||
class _MockComponentFactory extends ComponentFactory {
|
||||
constructor(private _compRef: ComponentRef) { super(null, null, null); }
|
||||
class _MockComponentFactory extends ComponentFactory<any> {
|
||||
constructor(private _compRef: ComponentRef<any>) { super(null, null, null); }
|
||||
create(injector: Injector, projectableNodes: any[][] = null,
|
||||
rootSelectorOrNode: string | any = null): ComponentRef {
|
||||
rootSelectorOrNode: string | any = null): ComponentRef<any> {
|
||||
return this._compRef;
|
||||
}
|
||||
}
|
||||
|
||||
class _MockComponentResolver implements ComponentResolver {
|
||||
constructor(private _compFactory: ComponentFactory) {}
|
||||
constructor(private _compFactory: ComponentFactory<any>) {}
|
||||
|
||||
resolveComponent(type: Type): Promise<ComponentFactory> {
|
||||
resolveComponent(type: Type): Promise<ComponentFactory<any>> {
|
||||
return PromiseWrapper.resolve(this._compFactory);
|
||||
}
|
||||
clearCache() {}
|
||||
}
|
||||
|
||||
class _MockComponentRef extends ComponentRef_ {
|
||||
class _MockComponentRef extends ComponentRef_<any> {
|
||||
constructor(private _injector: Injector) { super(null, null); }
|
||||
get injector(): Injector { return this._injector; }
|
||||
get changeDetectorRef(): ChangeDetectorRef { return <any>new SpyChangeDetectorRef(); }
|
||||
|
|
|
@ -82,7 +82,7 @@ export function main() {
|
|||
var directiveLog: DirectiveLog;
|
||||
|
||||
function createCompFixture(template: string, compType: Type = TestComponent,
|
||||
_tcb: TestComponentBuilder = null): ComponentFixture {
|
||||
_tcb: TestComponentBuilder = null): ComponentFixture<any> {
|
||||
if (isBlank(_tcb)) {
|
||||
_tcb = tcb;
|
||||
}
|
||||
|
@ -98,12 +98,14 @@ export function main() {
|
|||
return nodes.map(node => node.inject(dirType));
|
||||
}
|
||||
|
||||
function _bindSimpleProp(bindAttr: string, compType: Type = TestComponent): ComponentFixture {
|
||||
function _bindSimpleProp(bindAttr: string,
|
||||
compType: Type = TestComponent): ComponentFixture<any> {
|
||||
var template = `<div ${bindAttr}></div>`;
|
||||
return createCompFixture(template, compType);
|
||||
}
|
||||
|
||||
function _bindSimpleValue(expression: any, compType: Type = TestComponent): ComponentFixture {
|
||||
function _bindSimpleValue(expression: any,
|
||||
compType: Type = TestComponent): ComponentFixture<any> {
|
||||
return _bindSimpleProp(`[someProp]='${expression}'`, compType);
|
||||
}
|
||||
|
||||
|
@ -640,7 +642,7 @@ export function main() {
|
|||
});
|
||||
|
||||
describe('lifecycle', () => {
|
||||
function createCompWithContentAndViewChild(): ComponentFixture {
|
||||
function createCompWithContentAndViewChild(): ComponentFixture<any> {
|
||||
return createCompFixture(
|
||||
'<div testDirective="parent"><div *ngIf="true" testDirective="contentChild"></div><other-cmp></other-cmp></div>',
|
||||
TestComponent,
|
||||
|
|
|
@ -94,7 +94,7 @@ export function main() {
|
|||
it('should leave the view tree in a consistent state if hydration fails',
|
||||
inject([DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter],
|
||||
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async) => {
|
||||
tcb.createAsync(MyComp).then((tc: ComponentFixture) => {
|
||||
tcb.createAsync(MyComp).then((tc: ComponentFixture<any>) => {
|
||||
tc.detectChanges();
|
||||
PromiseWrapper.catchError(
|
||||
loader.loadNextToLocation(DynamicallyLoadedThrows,
|
||||
|
@ -146,7 +146,7 @@ export function main() {
|
|||
DOM.appendChild(doc.body, rootEl);
|
||||
loader.loadAsRoot(ChildComp, null, injector)
|
||||
.then((componentRef) => {
|
||||
var el = new ComponentFixture(componentRef, null, false);
|
||||
var el = new ComponentFixture<any>(componentRef, null, false);
|
||||
|
||||
expect(rootEl.parentNode).toBe(doc.body);
|
||||
|
||||
|
|
|
@ -770,14 +770,13 @@ function declareTests(isJit: boolean) {
|
|||
it("should allow to destroy a component from within a host event handler",
|
||||
fakeAsync(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
|
||||
var fixture: ComponentFixture;
|
||||
tcb.overrideView(MyComp, new ViewMetadata({
|
||||
template: '<push-cmp-with-host-event></push-cmp-with-host-event>',
|
||||
directives: [[[PushCmpWithHostEvent]]]
|
||||
}))
|
||||
|
||||
.createAsync(MyComp)
|
||||
.then(root => { fixture = root; });
|
||||
let fixture =
|
||||
tcb.overrideView(
|
||||
MyComp, new ViewMetadata({
|
||||
template: '<push-cmp-with-host-event></push-cmp-with-host-event>',
|
||||
directives: [[[PushCmpWithHostEvent]]]
|
||||
}))
|
||||
.createFakeAsync(MyComp);
|
||||
tick();
|
||||
fixture.detectChanges();
|
||||
|
||||
|
@ -865,8 +864,7 @@ function declareTests(isJit: boolean) {
|
|||
directives: [[[PushCmpWithAsyncPipe]]]
|
||||
}));
|
||||
|
||||
var fixture: ComponentFixture;
|
||||
tcb.createAsync(MyComp).then(root => { fixture = root; });
|
||||
let fixture = tcb.createFakeAsync(MyComp);
|
||||
tick();
|
||||
|
||||
var cmp: PushCmpWithAsyncPipe = fixture.debugElement.children[0].references['cmp'];
|
||||
|
@ -1500,8 +1498,7 @@ function declareTests(isJit: boolean) {
|
|||
directives: [DirectiveEmittingEvent, DirectiveListeningEvent]
|
||||
}));
|
||||
|
||||
var fixture: ComponentFixture;
|
||||
tcb.createAsync(MyComp).then(root => { fixture = root; });
|
||||
let fixture = tcb.createFakeAsync(MyComp);
|
||||
tick();
|
||||
|
||||
var tc = fixture.debugElement.children[0];
|
||||
|
@ -1606,7 +1603,7 @@ function declareTests(isJit: boolean) {
|
|||
directives: [SomeImperativeViewport]
|
||||
}))
|
||||
.createAsync(MyComp)
|
||||
.then((fixture: ComponentFixture) => {
|
||||
.then((fixture: ComponentFixture<any>) => {
|
||||
fixture.detectChanges();
|
||||
expect(anchorElement).toHaveText('');
|
||||
|
||||
|
@ -1828,8 +1825,7 @@ function declareTests(isJit: boolean) {
|
|||
directives: [DirectiveWithPropDecorators]
|
||||
}));
|
||||
|
||||
var fixture: ComponentFixture;
|
||||
tcb.createAsync(MyComp).then(root => { fixture = root; });
|
||||
let fixture = tcb.createFakeAsync(MyComp);
|
||||
tick();
|
||||
|
||||
var emitter = fixture.debugElement.children[0].inject(DirectiveWithPropDecorators);
|
||||
|
|
|
@ -293,7 +293,7 @@ export function main() {
|
|||
{template: '<simple stringProp="text"></simple>', directives: [Simple]}))
|
||||
.overrideTemplate(Simple, '<ng-content></ng-content><p>P,</p>{{stringProp}}')
|
||||
.createAsync(MainComp)
|
||||
.then((main: ComponentFixture) => {
|
||||
.then((main: ComponentFixture<any>) => {
|
||||
|
||||
main.detectChanges();
|
||||
|
||||
|
@ -314,7 +314,7 @@ export function main() {
|
|||
{template: '<simple stringProp="text"></simple>', directives: [Simple]}))
|
||||
.overrideTemplate(Simple, '<style></style><p>P,</p>{{stringProp}}')
|
||||
.createAsync(MainComp)
|
||||
.then((main: ComponentFixture) => {
|
||||
.then((main: ComponentFixture<any>) => {
|
||||
|
||||
main.detectChanges();
|
||||
expect(main.debugElement.nativeElement).toHaveText('P,text');
|
||||
|
|
|
@ -35,7 +35,7 @@ export function main() {
|
|||
it('should read the template from an annotation',
|
||||
inject([AsyncTestCompleter, ComponentResolver], (async, compiler: ComponentResolver) => {
|
||||
compiler.resolveComponent(SomeComponent)
|
||||
.then((compFactory: ComponentFactory) => {
|
||||
.then((compFactory: ComponentFactory<any>) => {
|
||||
expect(compFactory).toBe(someCompFactory);
|
||||
async.done();
|
||||
return null;
|
||||
|
|
|
@ -274,7 +274,7 @@ export function main() {
|
|||
var tcb: TestComponentBuilder;
|
||||
|
||||
function createCompFixture(template: string, tcb: TestComponentBuilder,
|
||||
comp: Type = null): ComponentFixture {
|
||||
comp: Type = null): ComponentFixture<any> {
|
||||
if (isBlank(comp)) {
|
||||
comp = TestComp;
|
||||
}
|
||||
|
|
|
@ -262,11 +262,11 @@ export function main() {
|
|||
|
||||
it('should register each application with the testability registry',
|
||||
inject([AsyncTestCompleter], (async) => {
|
||||
var refPromise1: Promise<ComponentRef> = bootstrap(HelloRootCmp, testProviders);
|
||||
var refPromise2: Promise<ComponentRef> = bootstrap(HelloRootCmp2, testProviders);
|
||||
var refPromise1: Promise<ComponentRef<any>> = bootstrap(HelloRootCmp, testProviders);
|
||||
var refPromise2: Promise<ComponentRef<any>> = bootstrap(HelloRootCmp2, testProviders);
|
||||
|
||||
PromiseWrapper.all([refPromise1, refPromise2])
|
||||
.then((refs: ComponentRef[]) => {
|
||||
.then((refs: ComponentRef<any>[]) => {
|
||||
var registry = refs[0].injector.get(TestabilityRegistry);
|
||||
var testabilities =
|
||||
[refs[0].injector.get(Testability), refs[1].injector.get(Testability)];
|
||||
|
|
|
@ -11,7 +11,7 @@ class SpyApplicationRef extends SpyObject implements ApplicationRef {
|
|||
}
|
||||
|
||||
@proxy
|
||||
class SpyComponentRef extends SpyObject implements ComponentRef {
|
||||
class SpyComponentRef extends SpyObject implements ComponentRef<dynamic> {
|
||||
Injector injector;
|
||||
|
||||
SpyComponentRef() {
|
||||
|
|
|
@ -59,8 +59,7 @@ export function main() {
|
|||
|
||||
it('should allow fakeAsync Tests to load components with templateUrl synchronously',
|
||||
fakeAsync(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
let fixture: ComponentFixture;
|
||||
tcb.createAsync(TestComponent).then((f) => { fixture = f; });
|
||||
let fixture = tcb.createFakeAsync(TestComponent);
|
||||
|
||||
// This should initialize the fixture.
|
||||
tick();
|
||||
|
|
|
@ -35,7 +35,7 @@ import {
|
|||
asyncRouteDataCmp
|
||||
} from './fixture_components';
|
||||
|
||||
function getLinkElement(rtc: ComponentFixture) {
|
||||
function getLinkElement(rtc: ComponentFixture<any>) {
|
||||
return rtc.debugElement.query(By.css('a')).nativeElement;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,13 +30,13 @@ import {
|
|||
import {specs, compile, clickOnElement, getHref} from '../util';
|
||||
import {BaseException} from 'angular2/src/facade/exceptions';
|
||||
|
||||
function getLinkElement(rtc: ComponentFixture, linkIndex: number = 0) {
|
||||
function getLinkElement(rtc: ComponentFixture<any>, linkIndex: number = 0) {
|
||||
return rtc.debugElement.queryAll(By.css('a'))[linkIndex].nativeElement;
|
||||
}
|
||||
|
||||
function auxRoutes() {
|
||||
var tcb: TestComponentBuilder;
|
||||
var fixture: ComponentFixture;
|
||||
var fixture: ComponentFixture<any>;
|
||||
var rtr;
|
||||
|
||||
beforeEach(inject([TestComponentBuilder, Router], (tcBuilder, router) => {
|
||||
|
@ -139,7 +139,7 @@ function auxRoutes() {
|
|||
|
||||
function auxRoutesWithAPrimaryRoute() {
|
||||
var tcb: TestComponentBuilder;
|
||||
var fixture: ComponentFixture;
|
||||
var fixture: ComponentFixture<any>;
|
||||
var rtr;
|
||||
|
||||
beforeEach(inject([TestComponentBuilder, Router], (tcBuilder, router) => {
|
||||
|
|
|
@ -142,7 +142,7 @@ export class RedirectToParentCmp {
|
|||
@Component({selector: 'dynamic-loader-cmp', template: `{ <div #viewport></div> }`})
|
||||
@RouteConfig([new Route({path: '/', component: HelloCmp})])
|
||||
export class DynamicLoaderCmp {
|
||||
private _componentRef: ComponentRef = null;
|
||||
private _componentRef: ComponentRef<any> = null;
|
||||
|
||||
@ViewChild('viewport', {read: ViewContainerRef}) viewport: ViewContainerRef;
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ import {
|
|||
import {PromiseWrapper} from 'angular2/src/facade/async';
|
||||
|
||||
|
||||
function getLinkElement(rtc: ComponentFixture) {
|
||||
function getLinkElement(rtc: ComponentFixture<any>) {
|
||||
return rtc.debugElement.query(By.css('a')).nativeElement;
|
||||
}
|
||||
|
||||
|
@ -431,7 +431,7 @@ function syncRoutesWithSyncChildrenWithDefaultRoutesWithoutParams() {
|
|||
}
|
||||
|
||||
function syncRoutesWithDynamicComponents() {
|
||||
var fixture: ComponentFixture;
|
||||
var fixture: ComponentFixture<any>;
|
||||
var tcb: TestComponentBuilder;
|
||||
var rtr: Router;
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ export function main() {
|
|||
describe('Router lifecycle hooks', () => {
|
||||
|
||||
var tcb: TestComponentBuilder;
|
||||
var fixture: ComponentFixture;
|
||||
var fixture: ComponentFixture<any>;
|
||||
var rtr: Router;
|
||||
|
||||
beforeEachProviders(() => TEST_ROUTER_PROVIDERS);
|
||||
|
|
|
@ -37,7 +37,7 @@ export function main() {
|
|||
describe('navigation', () => {
|
||||
|
||||
var tcb: TestComponentBuilder;
|
||||
var fixture: ComponentFixture;
|
||||
var fixture: ComponentFixture<any>;
|
||||
var rtr;
|
||||
|
||||
beforeEachProviders(() => TEST_ROUTER_PROVIDERS);
|
||||
|
|
|
@ -35,7 +35,7 @@ export function main() {
|
|||
describe('redirects', () => {
|
||||
|
||||
var tcb: TestComponentBuilder;
|
||||
var rootTC: ComponentFixture;
|
||||
var rootTC: ComponentFixture<any>;
|
||||
var rtr;
|
||||
|
||||
beforeEachProviders(() => TEST_ROUTER_PROVIDERS);
|
||||
|
|
|
@ -47,7 +47,7 @@ import {RouterLinkTransform} from 'angular2/src/router/directives/router_link_tr
|
|||
export function main() {
|
||||
describe('routerLink directive', function() {
|
||||
var tcb: TestComponentBuilder;
|
||||
var fixture: ComponentFixture;
|
||||
var fixture: ComponentFixture<any>;
|
||||
var router: Router;
|
||||
var location: Location;
|
||||
|
||||
|
@ -373,7 +373,7 @@ export function main() {
|
|||
});
|
||||
}
|
||||
|
||||
function getHref(tc: ComponentFixture) {
|
||||
function getHref(tc: ComponentFixture<any>) {
|
||||
return DOM.getAttribute(tc.debugElement.query(By.css('a')).nativeElement, 'href');
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import {
|
|||
ComponentFixtureNoNgZone
|
||||
} from 'angular2/testing_internal';
|
||||
|
||||
import {Injectable, provide} from 'angular2/core';
|
||||
import {Injectable, provide, ComponentResolver} from 'angular2/core';
|
||||
import {NgIf} from 'angular2/common';
|
||||
import {Directive, Component, ViewMetadata, Input} from 'angular2/src/core/metadata';
|
||||
import {IS_DART} from 'angular2/src/facade/lang';
|
||||
|
@ -460,6 +460,27 @@ export function main() {
|
|||
});
|
||||
}));
|
||||
});
|
||||
|
||||
describe('createSync', () => {
|
||||
it('should create components',
|
||||
inject([ComponentResolver, TestComponentBuilder, AsyncTestCompleter],
|
||||
(cr: ComponentResolver, tcb: TestComponentBuilder, async) => {
|
||||
cr.resolveComponent(MyIfComp).then((cmpFactory) => {
|
||||
let componentFixture = tcb.createSync(cmpFactory);
|
||||
|
||||
componentFixture.detectChanges();
|
||||
expect(componentFixture.nativeElement).toHaveText('MyIf()');
|
||||
|
||||
componentFixture.componentInstance.showMore = true;
|
||||
componentFixture.detectChanges();
|
||||
expect(componentFixture.nativeElement).toHaveText('MyIf(More)');
|
||||
|
||||
async.done();
|
||||
});
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -120,7 +120,7 @@ export function main() {
|
|||
return uiRenderStore.deserialize(id);
|
||||
}
|
||||
|
||||
function getRenderer(componentRef: ComponentRef) {
|
||||
function getRenderer(componentRef: ComponentRef<any>) {
|
||||
return (<any>componentRef.hostView).internalView.renderer;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,11 +29,11 @@ const CORE = [
|
|||
'AfterViewInit',
|
||||
'AfterViewInit.ngAfterViewInit():any',
|
||||
'ApplicationRef',
|
||||
'ApplicationRef.bootstrap(componentFactory:ComponentFactory):ComponentRef',
|
||||
'ApplicationRef.bootstrap(componentFactory:ComponentFactory<C>):ComponentRef<C>',
|
||||
'ApplicationRef.componentTypes:Type[]',
|
||||
'ApplicationRef.dispose():void',
|
||||
'ApplicationRef.injector:Injector',
|
||||
'ApplicationRef.registerBootstrapListener(listener:(ref: ComponentRef) => void):void',
|
||||
'ApplicationRef.registerBootstrapListener(listener:(ref: ComponentRef<any>) => void):void',
|
||||
'ApplicationRef.registerDisposeListener(dispose:() => void):void',
|
||||
'ApplicationRef.tick():void',
|
||||
'ApplicationRef.run(callback:Function):any',
|
||||
|
@ -74,7 +74,7 @@ const CORE = [
|
|||
'CollectionChangeRecord.toString():string',
|
||||
'ComponentResolver',
|
||||
'ComponentResolver.clearCache():any',
|
||||
'ComponentResolver.resolveComponent(componentType:Type):Promise<ComponentFactory>',
|
||||
'ComponentResolver.resolveComponent(componentType:Type):Promise<ComponentFactory<any>>',
|
||||
'ComponentDecorator',
|
||||
'ComponentDecorator.View(obj:{templateUrl?:string, template?:string, directives?:Array<Type|any[]>, pipes?:Array<Type|any[]>, renderer?:string, styles?:string[], styleUrls?:string[]}):ViewDecorator',
|
||||
'ComponentMetadataFactory',
|
||||
|
@ -91,10 +91,10 @@ const CORE = [
|
|||
'ComponentMetadata.templateUrl:string',
|
||||
'ComponentMetadata.viewBindings:any[]',
|
||||
'ComponentMetadata.viewProviders:any[]',
|
||||
'ComponentRef',
|
||||
'ComponentRef<C>',
|
||||
'ComponentRef.componentType:Type',
|
||||
'ComponentRef.injector:Injector',
|
||||
'ComponentRef.instance:any',
|
||||
'ComponentRef.instance:C',
|
||||
'ComponentRef.location:ElementRef',
|
||||
'ComponentRef.destroy():void',
|
||||
'ComponentRef.hostView:ViewRef',
|
||||
|
@ -159,8 +159,8 @@ const CORE = [
|
|||
'DoCheck',
|
||||
'DoCheck.ngDoCheck():any',
|
||||
'DynamicComponentLoader',
|
||||
'DynamicComponentLoader.loadAsRoot(type:Type, overrideSelectorOrNode:string|any, injector:Injector, onDispose:() => void, projectableNodes:any[][]):Promise<ComponentRef>',
|
||||
'DynamicComponentLoader.loadNextToLocation(type:Type, location:ViewContainerRef, providers:ResolvedReflectiveProvider[], projectableNodes:any[][]):Promise<ComponentRef>',
|
||||
'DynamicComponentLoader.loadAsRoot(type:Type, overrideSelectorOrNode:string|any, injector:Injector, onDispose:() => void, projectableNodes:any[][]):Promise<ComponentRef<any>>',
|
||||
'DynamicComponentLoader.loadNextToLocation(type:Type, location:ViewContainerRef, providers:ResolvedReflectiveProvider[], projectableNodes:any[][]):Promise<ComponentRef<any>>',
|
||||
'ElementRef',
|
||||
'ElementRef.nativeElement:any',
|
||||
'ElementRef.constructor(nativeElement:any)',
|
||||
|
@ -192,10 +192,10 @@ const CORE = [
|
|||
'HostListenerMetadata.constructor(eventName:string, args:string[])',
|
||||
'HostMetadata',
|
||||
'HostMetadata.toString():string',
|
||||
'ComponentFactory',
|
||||
'ComponentFactory<C>',
|
||||
'ComponentFactory.componentType:Type',
|
||||
'ComponentFactory.constructor(selector:string, _viewFactory:Function, _componentType:Type)',
|
||||
'ComponentFactory.create(injector:Injector, projectableNodes:any[][], rootSelectorOrNode:string|any):ComponentRef',
|
||||
'ComponentFactory.create(injector:Injector, projectableNodes:any[][], rootSelectorOrNode:string|any):ComponentRef<C>',
|
||||
'InjectMetadataFactory',
|
||||
'InjectMetadata',
|
||||
'InjectMetadata.constructor(token:any)',
|
||||
|
@ -445,8 +445,8 @@ const CORE = [
|
|||
'ViewChildrenMetadata.constructor(_selector:Type|string, {read=null}:{read?:any})',
|
||||
'ViewContainerRef',
|
||||
'ViewContainerRef.clear():void',
|
||||
'ViewContainerRef.createEmbeddedView(templateRef:TemplateRef<any>, context:any, index:number):EmbeddedViewRef<any>',
|
||||
'ViewContainerRef.createComponent(componentFactory:ComponentFactory, index:number, injector:Injector, projectableNodes:any[][]):ComponentRef',
|
||||
'ViewContainerRef.createEmbeddedView(templateRef:TemplateRef<C>, context:C, index:number):EmbeddedViewRef<C>',
|
||||
'ViewContainerRef.createComponent(componentFactory:ComponentFactory<C>, index:number, injector:Injector, projectableNodes:any[][]):ComponentRef<C>',
|
||||
'ViewContainerRef.detach(index:number):ViewRef',
|
||||
'ViewContainerRef.element:ElementRef',
|
||||
'ViewContainerRef.injector:Injector',
|
||||
|
@ -503,8 +503,8 @@ const CORE = [
|
|||
'createNgZone():NgZone',
|
||||
'enableProdMode():any',
|
||||
'forwardRef(forwardRefFn:ForwardRefFn):Type',
|
||||
'coreBootstrap(injector:Injector, componentFactory:ComponentFactory):ComponentRef',
|
||||
'coreLoadAndBootstrap(injector:Injector, componentType:Type):Promise<ComponentRef>',
|
||||
'coreBootstrap(injector:Injector, componentFactory:ComponentFactory<C>):ComponentRef<C>',
|
||||
'coreLoadAndBootstrap(injector:Injector, componentType:Type):Promise<ComponentRef<any>>',
|
||||
'assertPlatform(requiredToken:any):PlatformRef',
|
||||
'createPlatform(injector:Injector):PlatformRef',
|
||||
'disposePlatform():void',
|
||||
|
@ -1208,13 +1208,13 @@ const BROWSER = [
|
|||
'Title',
|
||||
'Title.getTitle():string',
|
||||
'Title.setTitle(newTitle:string):any',
|
||||
'bootstrapStatic(appComponentType:Type, customProviders:Array<any>, initReflector:Function):Promise<ComponentRef>',
|
||||
'bootstrapStatic(appComponentType:Type, customProviders:Array<any>, initReflector:Function):Promise<ComponentRef<any>>',
|
||||
'const BROWSER_APP_PROVIDERS:Array<any>',
|
||||
'const BROWSER_PROVIDERS:Array<any>',
|
||||
'const ELEMENT_PROBE_PROVIDERS:any[]',
|
||||
'const ELEMENT_PROBE_PROVIDERS_PROD_MODE:any[]',
|
||||
'disableDebugTools():void',
|
||||
'enableDebugTools(ref:ComponentRef):void',
|
||||
'enableDebugTools(ref:ComponentRef<any>):void',
|
||||
'inspectNativeElement(element:any):DebugNode',
|
||||
'browserStaticPlatform():PlatformRef'
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue