refactor(core): introduce ComponentFactory.
Each compile template now exposes a `<CompName>NgFactory` variable with an instance of a `ComponentFactory`. Calling `ComponentFactory.create` returns a `ComponentRef` that can be used directly. BREAKING CHANGE: - `Compiler` is renamed to `ComponentResolver`, `Compiler.compileInHost` has been renamed to `ComponentResolver.resolveComponent`. - `ComponentRef.dispose` is renamed to `ComponentRef.destroy` - `ViewContainerRef.createHostView` is renamed to `ViewContainerRef.createComponent` - `ComponentFixture_` has been removed, the class `ComponentFixture` can now be created directly as it is no more using private APIs.
This commit is contained in:
parent
41404057cf
commit
0c600cf6e3
|
@ -4,6 +4,7 @@ export {TEMPLATE_TRANSFORMS} from 'angular2/src/compiler/template_parser';
|
||||||
export {CompilerConfig, RenderTypes} from './config';
|
export {CompilerConfig, RenderTypes} from './config';
|
||||||
export * from './compile_metadata';
|
export * from './compile_metadata';
|
||||||
export * from './offline_compiler';
|
export * from './offline_compiler';
|
||||||
|
export {RuntimeCompiler} from './runtime_compiler';
|
||||||
export * from 'angular2/src/compiler/url_resolver';
|
export * from 'angular2/src/compiler/url_resolver';
|
||||||
export * from 'angular2/src/compiler/xhr';
|
export * from 'angular2/src/compiler/xhr';
|
||||||
|
|
||||||
|
@ -20,7 +21,7 @@ import {RuntimeMetadataResolver} from 'angular2/src/compiler/runtime_metadata';
|
||||||
import {StyleCompiler} from 'angular2/src/compiler/style_compiler';
|
import {StyleCompiler} from 'angular2/src/compiler/style_compiler';
|
||||||
import {ViewCompiler} from 'angular2/src/compiler/view_compiler/view_compiler';
|
import {ViewCompiler} from 'angular2/src/compiler/view_compiler/view_compiler';
|
||||||
import {CompilerConfig} from './config';
|
import {CompilerConfig} from './config';
|
||||||
import {Compiler} from 'angular2/src/core/linker/compiler';
|
import {ComponentResolver} from 'angular2/src/core/linker/component_resolver';
|
||||||
import {RuntimeCompiler} from 'angular2/src/compiler/runtime_compiler';
|
import {RuntimeCompiler} from 'angular2/src/compiler/runtime_compiler';
|
||||||
import {ElementSchemaRegistry} from 'angular2/src/compiler/schema/element_schema_registry';
|
import {ElementSchemaRegistry} from 'angular2/src/compiler/schema/element_schema_registry';
|
||||||
import {DomElementSchemaRegistry} from 'angular2/src/compiler/schema/dom_element_schema_registry';
|
import {DomElementSchemaRegistry} from 'angular2/src/compiler/schema/dom_element_schema_registry';
|
||||||
|
@ -51,7 +52,7 @@ export const COMPILER_PROVIDERS: Array<Type | Provider | any[]> = CONST_EXPR([
|
||||||
ViewCompiler,
|
ViewCompiler,
|
||||||
new Provider(CompilerConfig, {useFactory: _createCompilerConfig, deps: []}),
|
new Provider(CompilerConfig, {useFactory: _createCompilerConfig, deps: []}),
|
||||||
RuntimeCompiler,
|
RuntimeCompiler,
|
||||||
new Provider(Compiler, {useExisting: RuntimeCompiler}),
|
new Provider(ComponentResolver, {useExisting: RuntimeCompiler}),
|
||||||
DomElementSchemaRegistry,
|
DomElementSchemaRegistry,
|
||||||
new Provider(ElementSchemaRegistry, {useExisting: DomElementSchemaRegistry}),
|
new Provider(ElementSchemaRegistry, {useExisting: DomElementSchemaRegistry}),
|
||||||
UrlResolver,
|
UrlResolver,
|
||||||
|
|
|
@ -13,16 +13,16 @@ import {TemplateParser} from './template_parser';
|
||||||
import {DirectiveNormalizer} from './directive_normalizer';
|
import {DirectiveNormalizer} from './directive_normalizer';
|
||||||
import {OutputEmitter} from './output/abstract_emitter';
|
import {OutputEmitter} from './output/abstract_emitter';
|
||||||
import * as o from './output/output_ast';
|
import * as o from './output/output_ast';
|
||||||
import {HostViewFactory} from 'angular2/src/core/linker/view';
|
import {ComponentFactory} from 'angular2/src/core/linker/component_factory';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
MODULE_SUFFIX,
|
MODULE_SUFFIX,
|
||||||
} from './util';
|
} from './util';
|
||||||
|
|
||||||
var _HOST_VIEW_FACTORY_IDENTIFIER = new CompileIdentifierMetadata({
|
var _COMPONENT_FACTORY_IDENTIFIER = new CompileIdentifierMetadata({
|
||||||
name: 'HostViewFactory',
|
name: 'ComponentFactory',
|
||||||
runtime: HostViewFactory,
|
runtime: ComponentFactory,
|
||||||
moduleUrl: `asset:angular2/lib/src/core/linker/view${MODULE_SUFFIX}`
|
moduleUrl: `asset:angular2/lib/src/core/linker/component_factory${MODULE_SUFFIX}`
|
||||||
});
|
});
|
||||||
|
|
||||||
export class SourceModule {
|
export class SourceModule {
|
||||||
|
@ -59,17 +59,20 @@ export class OfflineCompiler {
|
||||||
exportedVars.push(compViewFactoryVar);
|
exportedVars.push(compViewFactoryVar);
|
||||||
|
|
||||||
var hostMeta = createHostComponentMeta(compMeta.type, compMeta.selector);
|
var hostMeta = createHostComponentMeta(compMeta.type, compMeta.selector);
|
||||||
var compHostViewFactoryVar = this._compileComponent(hostMeta, [compMeta], [], statements);
|
var hostViewFactoryVar = this._compileComponent(hostMeta, [compMeta], [], statements);
|
||||||
var hostViewFactoryVar = `hostViewFactory_${compMeta.type.name}`;
|
var compFactoryVar = `${compMeta.type.name}NgFactory`;
|
||||||
statements.push(
|
statements.push(o.variable(compFactoryVar)
|
||||||
o.variable(hostViewFactoryVar)
|
.set(o.importExpr(_COMPONENT_FACTORY_IDENTIFIER)
|
||||||
.set(o.importExpr(_HOST_VIEW_FACTORY_IDENTIFIER)
|
|
||||||
.instantiate(
|
.instantiate(
|
||||||
[o.literal(compMeta.selector), o.variable(compHostViewFactoryVar)],
|
[
|
||||||
o.importType(_HOST_VIEW_FACTORY_IDENTIFIER, null,
|
o.literal(compMeta.selector),
|
||||||
|
o.variable(hostViewFactoryVar),
|
||||||
|
o.importExpr(compMeta.type)
|
||||||
|
],
|
||||||
|
o.importType(_COMPONENT_FACTORY_IDENTIFIER, null,
|
||||||
[o.TypeModifier.Const])))
|
[o.TypeModifier.Const])))
|
||||||
.toDeclStmt(null, [o.StmtModifier.Final]));
|
.toDeclStmt(null, [o.StmtModifier.Final]));
|
||||||
exportedVars.push(hostViewFactoryVar);
|
exportedVars.push(compFactoryVar);
|
||||||
});
|
});
|
||||||
return this._codegenSourceModule(moduleUrl, statements, exportedVars);
|
return this._codegenSourceModule(moduleUrl, statements, exportedVars);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import {isPresent} from 'angular2/src/facade/lang';
|
import {isPresent} from 'angular2/src/facade/lang';
|
||||||
import {AppView} from 'angular2/src/core/linker/view';
|
import {AppView} from 'angular2/src/core/linker/view';
|
||||||
|
import {AppElement} from 'angular2/src/core/linker/element';
|
||||||
import {BaseException} from 'angular2/src/facade/exceptions';
|
import {BaseException} from 'angular2/src/facade/exceptions';
|
||||||
import {InstanceFactory, DynamicInstance} from './output_interpreter';
|
import {InstanceFactory, DynamicInstance} from './output_interpreter';
|
||||||
|
|
||||||
|
@ -19,12 +20,12 @@ class _InterpretiveAppView extends AppView<any> implements DynamicInstance {
|
||||||
super(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9],
|
super(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9],
|
||||||
args[10]);
|
args[10]);
|
||||||
}
|
}
|
||||||
createInternal(rootSelector: string): void {
|
createInternal(rootSelector: string | any): AppElement {
|
||||||
var m = this.methods.get('createInternal');
|
var m = this.methods.get('createInternal');
|
||||||
if (isPresent(m)) {
|
if (isPresent(m)) {
|
||||||
m(rootSelector);
|
return m(rootSelector);
|
||||||
} else {
|
} else {
|
||||||
super.createInternal(rootSelector);
|
return super.createInternal(rootSelector);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
injectorGetInternal(token: any, nodeIndex: number, notFoundResult: any): any {
|
injectorGetInternal(token: any, nodeIndex: number, notFoundResult: any): any {
|
||||||
|
|
|
@ -46,9 +46,11 @@ import {ViewCompiler} from './view_compiler/view_compiler';
|
||||||
import {TemplateParser} from './template_parser';
|
import {TemplateParser} from './template_parser';
|
||||||
import {DirectiveNormalizer} from './directive_normalizer';
|
import {DirectiveNormalizer} from './directive_normalizer';
|
||||||
import {RuntimeMetadataResolver} from './runtime_metadata';
|
import {RuntimeMetadataResolver} from './runtime_metadata';
|
||||||
import {HostViewFactory} from 'angular2/src/core/linker/view';
|
import {ComponentFactory} from 'angular2/src/core/linker/component_factory';
|
||||||
import {HostViewFactoryRef, HostViewFactoryRef_} from 'angular2/src/core/linker/view_ref';
|
import {
|
||||||
import {Compiler, Compiler_} from 'angular2/src/core/linker/compiler';
|
ComponentResolver,
|
||||||
|
ReflectorComponentResolver
|
||||||
|
} from 'angular2/src/core/linker/component_resolver';
|
||||||
|
|
||||||
import {CompilerConfig} from './config';
|
import {CompilerConfig} from './config';
|
||||||
import * as ir from './output/output_ast';
|
import * as ir from './output/output_ast';
|
||||||
|
@ -64,7 +66,7 @@ import {XHR} from 'angular2/src/compiler/xhr';
|
||||||
* ready for linking into an application.
|
* ready for linking into an application.
|
||||||
*/
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class RuntimeCompiler extends Compiler_ {
|
export class RuntimeCompiler implements ComponentResolver {
|
||||||
private _styleCache: Map<string, Promise<string>> = new Map<string, Promise<string>>();
|
private _styleCache: Map<string, Promise<string>> = new Map<string, Promise<string>>();
|
||||||
private _hostCacheKeys = new Map<Type, any>();
|
private _hostCacheKeys = new Map<Type, any>();
|
||||||
private _compiledTemplateCache = new Map<any, CompiledTemplate>();
|
private _compiledTemplateCache = new Map<any, CompiledTemplate>();
|
||||||
|
@ -74,11 +76,9 @@ export class RuntimeCompiler extends Compiler_ {
|
||||||
private _templateNormalizer: DirectiveNormalizer,
|
private _templateNormalizer: DirectiveNormalizer,
|
||||||
private _templateParser: TemplateParser, private _styleCompiler: StyleCompiler,
|
private _templateParser: TemplateParser, private _styleCompiler: StyleCompiler,
|
||||||
private _viewCompiler: ViewCompiler, private _xhr: XHR,
|
private _viewCompiler: ViewCompiler, private _xhr: XHR,
|
||||||
private _genConfig: CompilerConfig) {
|
private _genConfig: CompilerConfig) {}
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
compileInHost(componentType: Type): Promise<HostViewFactoryRef_> {
|
resolveComponent(componentType: Type): Promise<ComponentFactory> {
|
||||||
var compMeta: CompileDirectiveMetadata =
|
var compMeta: CompileDirectiveMetadata =
|
||||||
this._runtimeMetadataResolver.getDirectiveMetadata(componentType);
|
this._runtimeMetadataResolver.getDirectiveMetadata(componentType);
|
||||||
var hostCacheKey = this._hostCacheKeys.get(componentType);
|
var hostCacheKey = this._hostCacheKeys.get(componentType);
|
||||||
|
@ -92,8 +92,8 @@ export class RuntimeCompiler extends Compiler_ {
|
||||||
this._loadAndCompileComponent(hostCacheKey, hostMeta, [compMeta], [], []);
|
this._loadAndCompileComponent(hostCacheKey, hostMeta, [compMeta], [], []);
|
||||||
}
|
}
|
||||||
return this._compiledTemplateDone.get(hostCacheKey)
|
return this._compiledTemplateDone.get(hostCacheKey)
|
||||||
.then((compiledTemplate: CompiledTemplate) => new HostViewFactoryRef_(
|
.then((compiledTemplate: CompiledTemplate) => new ComponentFactory(
|
||||||
new HostViewFactory(compMeta.selector, compiledTemplate.viewFactory)));
|
compMeta.selector, compiledTemplate.viewFactory, componentType));
|
||||||
}
|
}
|
||||||
|
|
||||||
clearCache() {
|
clearCache() {
|
||||||
|
|
|
@ -1,77 +0,0 @@
|
||||||
var nodeDebugInfos_MyComp1 = [
|
|
||||||
new jit_StaticNodeDebugInfo0([],null,{}),
|
|
||||||
new jit_StaticNodeDebugInfo0([],null,{})
|
|
||||||
]
|
|
||||||
;
|
|
||||||
function _View_MyComp1(viewManager,renderer,parentInjector,declarationEl,projectableNodes) {
|
|
||||||
var self = this;
|
|
||||||
jit_AppView1.call(this, './MyComp',_View_MyComp1,jit_ViewType_EMBEDDED2,{'some-tmpl': null},renderer,viewManager,parentInjector,projectableNodes,declarationEl,jit_ChangeDetectionStrategy_Default3,nodeDebugInfos_MyComp1);
|
|
||||||
}
|
|
||||||
_View_MyComp1.prototype = Object.create(jit_AppView1.prototype);
|
|
||||||
_View_MyComp1.prototype.createInternal = function(rootSelector) {
|
|
||||||
var self = this;
|
|
||||||
self._el_0 = self.renderer.createElement(null,'copy-me',self.debug(0,0,49));
|
|
||||||
self._text_1 = self.renderer.createText(self._el_0,'',self.debug(1,0,58));
|
|
||||||
self._expr_0 = jit_uninitialized4;
|
|
||||||
self.init([].concat([self._el_0]),[
|
|
||||||
self._el_0,
|
|
||||||
self._text_1
|
|
||||||
]
|
|
||||||
,{},[],[]);
|
|
||||||
};
|
|
||||||
_View_MyComp1.prototype.detectChangesInternal = function(throwOnChange) {
|
|
||||||
var self = this;
|
|
||||||
var currVal = null;
|
|
||||||
self.debug(1,0,58);
|
|
||||||
currVal = jit_interpolate5(1,'',self.locals['some-tmpl'],'');
|
|
||||||
if (jit_checkBinding6(throwOnChange,self._expr_0,currVal)) {
|
|
||||||
self.renderer.setText(self._text_1,currVal);
|
|
||||||
self._expr_0 = currVal;
|
|
||||||
}
|
|
||||||
self.detectContentChildrenChanges(throwOnChange); }
|
|
||||||
self.detectViewChildrenChanges(throwOnChange); }
|
|
||||||
};
|
|
||||||
function viewFactory_MyComp1(viewManager,parentInjector,declarationEl,projectableNodes,rootSelector) {
|
|
||||||
projectableNodes = jit_ensureSlotCount7(projectableNodes,0);
|
|
||||||
var renderer = declarationEl.parentView.renderer;
|
|
||||||
var view = new _View_MyComp1(viewManager,renderer,parentInjector,declarationEl,projectableNodes);
|
|
||||||
view.create(rootSelector);
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
var nodeDebugInfos_MyComp0 = [new jit_StaticNodeDebugInfo0([
|
|
||||||
jit_TemplateRef8,
|
|
||||||
jit_SomeViewport9
|
|
||||||
]
|
|
||||||
,null,{})];
|
|
||||||
var renderType_MyComp = null;
|
|
||||||
function _View_MyComp0(viewManager,renderer,parentInjector,declarationEl,projectableNodes) {
|
|
||||||
var self = this;
|
|
||||||
jit_AppView1.call(this, './MyComp',_View_MyComp0,jit_ViewType_COMPONENT10,{},renderer,viewManager,parentInjector,projectableNodes,declarationEl,jit_ChangeDetectionStrategy_Default3,nodeDebugInfos_MyComp0);
|
|
||||||
}
|
|
||||||
_View_MyComp0.prototype = Object.create(jit_AppView1.prototype);
|
|
||||||
_View_MyComp0.prototype.createInternal = function(rootSelector) {
|
|
||||||
var self = this;
|
|
||||||
var parentRenderNode = self.renderer.createViewRoot(self.declarationAppElement.nativeElement);
|
|
||||||
self._anchor_0 = self.renderer.createTemplateAnchor(parentRenderNode,self.debug(0,0,0));
|
|
||||||
self.debug(null,null,null);
|
|
||||||
self._appEl_0 = new jit_AppElement11(0,null,self,self._anchor_0);
|
|
||||||
self._TemplateRef_0_0 = new jit_TemplateRef_12(self._appEl_0,viewFactory_MyComp1);
|
|
||||||
self._SomeViewport_0_1 = new jit_SomeViewport9(self._appEl_0.vcRef,self._TemplateRef_0_0);
|
|
||||||
self.init([],[self._anchor_0],{},[],[]);
|
|
||||||
};
|
|
||||||
_View_MyComp0.prototype.injectorGetInternal = function(token,requestNodeIndex,notFoundResult) {
|
|
||||||
var self = this;
|
|
||||||
if (((token === jit_TemplateRef8) && (0 === requestNodeIndex))) { return self._TemplateRef_0_0; }
|
|
||||||
if (((token === jit_SomeViewport9) && (0 === requestNodeIndex))) { return self._SomeViewport_0_1; }
|
|
||||||
return notFoundResult;
|
|
||||||
};
|
|
||||||
function viewFactory_MyComp0(viewManager,parentInjector,declarationEl,projectableNodes,rootSelector) {
|
|
||||||
if ((renderType_MyComp === null)) { (renderType_MyComp = viewManager.createRenderComponentType(jit_ViewType_EMBEDDED2,jit_undefined13)); }
|
|
||||||
projectableNodes = jit_ensureSlotCount7(projectableNodes,0);
|
|
||||||
var renderer = viewManager.renderComponent(renderType_MyComp);
|
|
||||||
var view = new _View_MyComp0(viewManager,renderer,parentInjector,declarationEl,projectableNodes);
|
|
||||||
view.create(rootSelector);
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
return viewFactory_MyComp0
|
|
||||||
//# sourceURL=MyComp.template.js
|
|
|
@ -43,7 +43,6 @@ import {getViewFactoryName, createFlatArray, createDiTokenExpression} from './ut
|
||||||
|
|
||||||
import {ViewType} from 'angular2/src/core/linker/view_type';
|
import {ViewType} from 'angular2/src/core/linker/view_type';
|
||||||
import {ViewEncapsulation} from 'angular2/src/core/metadata/view';
|
import {ViewEncapsulation} from 'angular2/src/core/metadata/view';
|
||||||
import {HOST_VIEW_ELEMENT_NAME} from 'angular2/src/core/linker/view';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
CompileIdentifierMetadata,
|
CompileIdentifierMetadata,
|
||||||
|
@ -185,17 +184,13 @@ class ViewBuilderVisitor implements TemplateAstVisitor {
|
||||||
var nodeIndex = this.view.nodes.length;
|
var nodeIndex = this.view.nodes.length;
|
||||||
var createRenderNodeExpr;
|
var createRenderNodeExpr;
|
||||||
var debugContextExpr = this.view.createMethod.resetDebugInfoExpr(nodeIndex, ast);
|
var debugContextExpr = this.view.createMethod.resetDebugInfoExpr(nodeIndex, ast);
|
||||||
var createElementExpr = ViewProperties.renderer.callMethod(
|
if (nodeIndex === 0 && this.view.viewType === ViewType.HOST) {
|
||||||
|
createRenderNodeExpr = o.THIS_EXPR.callMethod(
|
||||||
|
'selectOrCreateHostElement', [o.literal(ast.name), rootSelectorVar, debugContextExpr]);
|
||||||
|
} else {
|
||||||
|
createRenderNodeExpr = ViewProperties.renderer.callMethod(
|
||||||
'createElement',
|
'createElement',
|
||||||
[this._getParentRenderNode(parent), o.literal(ast.name), debugContextExpr]);
|
[this._getParentRenderNode(parent), o.literal(ast.name), debugContextExpr]);
|
||||||
if (nodeIndex === 0 && this.view.viewType === ViewType.HOST) {
|
|
||||||
createRenderNodeExpr =
|
|
||||||
rootSelectorVar.identical(o.NULL_EXPR)
|
|
||||||
.conditional(createElementExpr,
|
|
||||||
ViewProperties.renderer.callMethod('selectRootElement',
|
|
||||||
[rootSelectorVar, debugContextExpr]));
|
|
||||||
} else {
|
|
||||||
createRenderNodeExpr = createElementExpr;
|
|
||||||
}
|
}
|
||||||
var fieldName = `_el_${nodeIndex}`;
|
var fieldName = `_el_${nodeIndex}`;
|
||||||
this.view.fields.push(
|
this.view.fields.push(
|
||||||
|
@ -342,9 +337,6 @@ function _readHtmlAndDirectiveVariables(elementExportAsVars: VariableAst[],
|
||||||
elementExportAsVars.forEach((varAst) => {
|
elementExportAsVars.forEach((varAst) => {
|
||||||
variables[varAst.name] = isPresent(component) ? identifierToken(component.type) : null;
|
variables[varAst.name] = isPresent(component) ? identifierToken(component.type) : null;
|
||||||
});
|
});
|
||||||
if (viewType === ViewType.HOST) {
|
|
||||||
variables[HOST_VIEW_ELEMENT_NAME] = null;
|
|
||||||
}
|
|
||||||
return variables;
|
return variables;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -444,7 +436,7 @@ function createViewClass(view: CompileView, renderCompTypeVar: o.ReadVarExpr,
|
||||||
|
|
||||||
var viewMethods = [
|
var viewMethods = [
|
||||||
new o.ClassMethod('createInternal', [new o.FnParam(rootSelectorVar.name, o.STRING_TYPE)],
|
new o.ClassMethod('createInternal', [new o.FnParam(rootSelectorVar.name, o.STRING_TYPE)],
|
||||||
generateCreateMethod(view)),
|
generateCreateMethod(view), o.importType(Identifiers.AppElement)),
|
||||||
new o.ClassMethod(
|
new o.ClassMethod(
|
||||||
'injectorGetInternal',
|
'injectorGetInternal',
|
||||||
[
|
[
|
||||||
|
@ -519,6 +511,12 @@ function generateCreateMethod(view: CompileView): o.Statement[] {
|
||||||
.toDeclStmt(o.importType(view.genConfig.renderTypes.renderNode), [o.StmtModifier.Final])
|
.toDeclStmt(o.importType(view.genConfig.renderTypes.renderNode), [o.StmtModifier.Final])
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
var resultExpr: o.Expression;
|
||||||
|
if (view.viewType === ViewType.HOST) {
|
||||||
|
resultExpr = (<CompileElement>view.nodes[0]).getOrCreateAppElement();
|
||||||
|
} else {
|
||||||
|
resultExpr = o.NULL_EXPR;
|
||||||
|
}
|
||||||
return parentRenderNodeStmts.concat(view.createMethod.finish())
|
return parentRenderNodeStmts.concat(view.createMethod.finish())
|
||||||
.concat([
|
.concat([
|
||||||
o.THIS_EXPR.callMethod('init',
|
o.THIS_EXPR.callMethod('init',
|
||||||
|
@ -529,7 +527,8 @@ function generateCreateMethod(view: CompileView): o.Statement[] {
|
||||||
o.literalArr(view.disposables),
|
o.literalArr(view.disposables),
|
||||||
o.literalArr(view.subscriptions)
|
o.literalArr(view.subscriptions)
|
||||||
])
|
])
|
||||||
.toStmt()
|
.toStmt(),
|
||||||
|
new o.ReturnStatement(resultExpr)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,8 @@ import {
|
||||||
} from './change_detection/change_detection';
|
} from './change_detection/change_detection';
|
||||||
import {AppViewManager} from './linker/view_manager';
|
import {AppViewManager} from './linker/view_manager';
|
||||||
import {AppViewManager_} from "./linker/view_manager";
|
import {AppViewManager_} from "./linker/view_manager";
|
||||||
import {Compiler} from './linker/compiler';
|
import {ComponentResolver} from './linker/component_resolver';
|
||||||
import {Compiler_} from "./linker/compiler";
|
import {ReflectorComponentResolver} from "./linker/component_resolver";
|
||||||
import {DynamicComponentLoader} from './linker/dynamic_component_loader';
|
import {DynamicComponentLoader} from './linker/dynamic_component_loader';
|
||||||
import {DynamicComponentLoader_} from "./linker/dynamic_component_loader";
|
import {DynamicComponentLoader_} from "./linker/dynamic_component_loader";
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ var __unused: Type; // avoid unused import when Type union types are erased
|
||||||
* application, regardless of the platform it runs onto.
|
* application, regardless of the platform it runs onto.
|
||||||
*/
|
*/
|
||||||
export const APPLICATION_COMMON_PROVIDERS: Array<Type | Provider | any[]> = CONST_EXPR([
|
export const APPLICATION_COMMON_PROVIDERS: Array<Type | Provider | any[]> = CONST_EXPR([
|
||||||
new Provider(Compiler, {useClass: Compiler_}),
|
new Provider(ComponentResolver, {useClass: ReflectorComponentResolver}),
|
||||||
APP_ID_RANDOM_PROVIDER,
|
APP_ID_RANDOM_PROVIDER,
|
||||||
new Provider(AppViewManager, {useClass: AppViewManager_}),
|
new Provider(AppViewManager, {useClass: AppViewManager_}),
|
||||||
new Provider(IterableDiffers, {useValue: defaultIterableDiffers}),
|
new Provider(IterableDiffers, {useValue: defaultIterableDiffers}),
|
||||||
|
|
|
@ -18,10 +18,8 @@ import {
|
||||||
import {PromiseWrapper, PromiseCompleter, ObservableWrapper} from 'angular2/src/facade/async';
|
import {PromiseWrapper, PromiseCompleter, ObservableWrapper} from 'angular2/src/facade/async';
|
||||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
import {ListWrapper} from 'angular2/src/facade/collection';
|
||||||
import {TestabilityRegistry, Testability} from 'angular2/src/core/testability/testability';
|
import {TestabilityRegistry, Testability} from 'angular2/src/core/testability/testability';
|
||||||
import {
|
import {DynamicComponentLoader} from 'angular2/src/core/linker/dynamic_component_loader';
|
||||||
ComponentRef,
|
import {ComponentRef} from 'angular2/src/core/linker/component_factory';
|
||||||
DynamicComponentLoader
|
|
||||||
} from 'angular2/src/core/linker/dynamic_component_loader';
|
|
||||||
import {
|
import {
|
||||||
BaseException,
|
BaseException,
|
||||||
WrappedException,
|
WrappedException,
|
||||||
|
@ -32,7 +30,6 @@ import {Console} from 'angular2/src/core/console';
|
||||||
import {wtfLeave, wtfCreateScope, WtfScopeFn} from './profile/profile';
|
import {wtfLeave, wtfCreateScope, WtfScopeFn} from './profile/profile';
|
||||||
import {ChangeDetectorRef} from 'angular2/src/core/change_detection/change_detector_ref';
|
import {ChangeDetectorRef} from 'angular2/src/core/change_detection/change_detector_ref';
|
||||||
import {lockMode} from 'angular2/src/facade/lang';
|
import {lockMode} from 'angular2/src/facade/lang';
|
||||||
import {ElementRef_} from 'angular2/src/core/linker/element_ref';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct providers specific to an individual root component.
|
* Construct providers specific to an individual root component.
|
||||||
|
@ -457,8 +454,7 @@ export class ApplicationRef_ extends ApplicationRef {
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
_loadComponent(componentRef: ComponentRef): void {
|
_loadComponent(componentRef: ComponentRef): void {
|
||||||
var appChangeDetector = (<ElementRef_>componentRef.location).internalElement.parentView;
|
this._changeDetectorRefs.push(componentRef.changeDetectorRef);
|
||||||
this._changeDetectorRefs.push(appChangeDetector.ref);
|
|
||||||
this.tick();
|
this.tick();
|
||||||
this._rootComponents.push(componentRef);
|
this._rootComponents.push(componentRef);
|
||||||
this._bootstrapListeners.forEach((listener) => listener(componentRef));
|
this._bootstrapListeners.forEach((listener) => listener(componentRef));
|
||||||
|
@ -469,8 +465,7 @@ export class ApplicationRef_ extends ApplicationRef {
|
||||||
if (!ListWrapper.contains(this._rootComponents, componentRef)) {
|
if (!ListWrapper.contains(this._rootComponents, componentRef)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.unregisterChangeDetector(
|
this.unregisterChangeDetector(componentRef.changeDetectorRef);
|
||||||
(<ElementRef_>componentRef.location).internalElement.parentView.ref);
|
|
||||||
ListWrapper.remove(this._rootComponents, componentRef);
|
ListWrapper.remove(this._rootComponents, componentRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -498,7 +493,7 @@ export class ApplicationRef_ extends ApplicationRef {
|
||||||
|
|
||||||
dispose(): void {
|
dispose(): void {
|
||||||
// TODO(alxhub): Dispose of the NgZone.
|
// TODO(alxhub): Dispose of the NgZone.
|
||||||
ListWrapper.clone(this._rootComponents).forEach((ref) => ref.dispose());
|
ListWrapper.clone(this._rootComponents).forEach((ref) => ref.destroy());
|
||||||
this._disposeListeners.forEach((dispose) => dispose());
|
this._disposeListeners.forEach((dispose) => dispose());
|
||||||
this._platform._applicationDisposed(this);
|
this._platform._applicationDisposed(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,8 @@ export class DebugDomRootRenderer implements RootRenderer {
|
||||||
export class DebugDomRenderer implements Renderer {
|
export class DebugDomRenderer implements Renderer {
|
||||||
constructor(private _delegate: Renderer) {}
|
constructor(private _delegate: Renderer) {}
|
||||||
|
|
||||||
selectRootElement(selector: string, debugInfo: RenderDebugInfo): any {
|
selectRootElement(selectorOrNode: string | any, debugInfo: RenderDebugInfo): any {
|
||||||
var nativeEl = this._delegate.selectRootElement(selector, debugInfo);
|
var nativeEl = this._delegate.selectRootElement(selectorOrNode, debugInfo);
|
||||||
var debugEl = new DebugElement(nativeEl, null, debugInfo);
|
var debugEl = new DebugElement(nativeEl, null, debugInfo);
|
||||||
indexDebugNode(debugEl);
|
indexDebugNode(debugEl);
|
||||||
return nativeEl;
|
return nativeEl;
|
||||||
|
|
|
@ -11,7 +11,7 @@ import {makeDecorator, makeParamDecorator} from '../util/decorators';
|
||||||
/**
|
/**
|
||||||
* Factory for creating {@link InjectMetadata}.
|
* Factory for creating {@link InjectMetadata}.
|
||||||
*/
|
*/
|
||||||
export interface InjectFactory {
|
export interface InjectMetadataFactory {
|
||||||
(token: any): any;
|
(token: any): any;
|
||||||
new (token: any): InjectMetadata;
|
new (token: any): InjectMetadata;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ export interface InjectFactory {
|
||||||
/**
|
/**
|
||||||
* Factory for creating {@link OptionalMetadata}.
|
* Factory for creating {@link OptionalMetadata}.
|
||||||
*/
|
*/
|
||||||
export interface OptionalFactory {
|
export interface OptionalMetadataFactory {
|
||||||
(): any;
|
(): any;
|
||||||
new (): OptionalMetadata;
|
new (): OptionalMetadata;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ export interface OptionalFactory {
|
||||||
/**
|
/**
|
||||||
* Factory for creating {@link InjectableMetadata}.
|
* Factory for creating {@link InjectableMetadata}.
|
||||||
*/
|
*/
|
||||||
export interface InjectableFactory {
|
export interface InjectableMetadataFactory {
|
||||||
(): any;
|
(): any;
|
||||||
new (): InjectableMetadata;
|
new (): InjectableMetadata;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ export interface InjectableFactory {
|
||||||
/**
|
/**
|
||||||
* Factory for creating {@link SelfMetadata}.
|
* Factory for creating {@link SelfMetadata}.
|
||||||
*/
|
*/
|
||||||
export interface SelfFactory {
|
export interface SelfMetadataFactory {
|
||||||
(): any;
|
(): any;
|
||||||
new (): SelfMetadata;
|
new (): SelfMetadata;
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ export interface SelfFactory {
|
||||||
/**
|
/**
|
||||||
* Factory for creating {@link HostMetadata}.
|
* Factory for creating {@link HostMetadata}.
|
||||||
*/
|
*/
|
||||||
export interface HostFactory {
|
export interface HostMetadataFactory {
|
||||||
(): any;
|
(): any;
|
||||||
new (): HostMetadata;
|
new (): HostMetadata;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ export interface HostFactory {
|
||||||
/**
|
/**
|
||||||
* Factory for creating {@link SkipSelfMetadata}.
|
* Factory for creating {@link SkipSelfMetadata}.
|
||||||
*/
|
*/
|
||||||
export interface SkipSelfFactory {
|
export interface SkipSelfMetadataFactory {
|
||||||
(): any;
|
(): any;
|
||||||
new (): SkipSelfMetadata;
|
new (): SkipSelfMetadata;
|
||||||
}
|
}
|
||||||
|
@ -59,29 +59,30 @@ export interface SkipSelfFactory {
|
||||||
/**
|
/**
|
||||||
* Factory for creating {@link InjectMetadata}.
|
* Factory for creating {@link InjectMetadata}.
|
||||||
*/
|
*/
|
||||||
export var Inject: InjectFactory = makeParamDecorator(InjectMetadata);
|
export var Inject: InjectMetadataFactory = makeParamDecorator(InjectMetadata);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Factory for creating {@link OptionalMetadata}.
|
* Factory for creating {@link OptionalMetadata}.
|
||||||
*/
|
*/
|
||||||
export var Optional: OptionalFactory = makeParamDecorator(OptionalMetadata);
|
export var Optional: OptionalMetadataFactory = makeParamDecorator(OptionalMetadata);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Factory for creating {@link InjectableMetadata}.
|
* Factory for creating {@link InjectableMetadata}.
|
||||||
*/
|
*/
|
||||||
export var Injectable: InjectableFactory = <InjectableFactory>makeDecorator(InjectableMetadata);
|
export var Injectable: InjectableMetadataFactory =
|
||||||
|
<InjectableMetadataFactory>makeDecorator(InjectableMetadata);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Factory for creating {@link SelfMetadata}.
|
* Factory for creating {@link SelfMetadata}.
|
||||||
*/
|
*/
|
||||||
export var Self: SelfFactory = makeParamDecorator(SelfMetadata);
|
export var Self: SelfMetadataFactory = makeParamDecorator(SelfMetadata);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Factory for creating {@link HostMetadata}.
|
* Factory for creating {@link HostMetadata}.
|
||||||
*/
|
*/
|
||||||
export var Host: HostFactory = makeParamDecorator(HostMetadata);
|
export var Host: HostMetadataFactory = makeParamDecorator(HostMetadata);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Factory for creating {@link SkipSelfMetadata}.
|
* Factory for creating {@link SkipSelfMetadata}.
|
||||||
*/
|
*/
|
||||||
export var SkipSelf: SkipSelfFactory = makeParamDecorator(SkipSelfMetadata);
|
export var SkipSelf: SkipSelfMetadataFactory = makeParamDecorator(SkipSelfMetadata);
|
|
@ -1,11 +1,11 @@
|
||||||
// Public API for compiler
|
// Public API for compiler
|
||||||
export {Compiler} from './linker/compiler';
|
export {ComponentResolver} from './linker/component_resolver';
|
||||||
export {AppViewManager} from './linker/view_manager';
|
export {AppViewManager} from './linker/view_manager';
|
||||||
export {QueryList} from './linker/query_list';
|
export {QueryList} from './linker/query_list';
|
||||||
export {DynamicComponentLoader} from './linker/dynamic_component_loader';
|
export {DynamicComponentLoader} from './linker/dynamic_component_loader';
|
||||||
export {ElementRef} from './linker/element_ref';
|
export {ElementRef} from './linker/element_ref';
|
||||||
export {TemplateRef} from './linker/template_ref';
|
export {TemplateRef} from './linker/template_ref';
|
||||||
export {EmbeddedViewRef, HostViewRef, ViewRef, HostViewFactoryRef} from './linker/view_ref';
|
export {EmbeddedViewRef, ViewRef} from './linker/view_ref';
|
||||||
export {ViewContainerRef} from './linker/view_container_ref';
|
export {ViewContainerRef} from './linker/view_container_ref';
|
||||||
export {ComponentRef} from './linker/dynamic_component_loader';
|
export {ComponentRef, ComponentFactory} from './linker/component_factory';
|
||||||
export {ExpressionChangedAfterItHasBeenCheckedException} from './linker/exceptions';
|
export {ExpressionChangedAfterItHasBeenCheckedException} from './linker/exceptions';
|
|
@ -1,40 +0,0 @@
|
||||||
import {HostViewFactoryRef} from 'angular2/src/core/linker/view_ref';
|
|
||||||
|
|
||||||
import {Injectable} from 'angular2/src/core/di';
|
|
||||||
import {Type, isBlank, stringify} from 'angular2/src/facade/lang';
|
|
||||||
import {BaseException} from 'angular2/src/facade/exceptions';
|
|
||||||
import {PromiseWrapper} from 'angular2/src/facade/async';
|
|
||||||
import {reflector} from 'angular2/src/core/reflection/reflection';
|
|
||||||
import {HostViewFactory} from 'angular2/src/core/linker/view';
|
|
||||||
import {HostViewFactoryRef_} from 'angular2/src/core/linker/view_ref';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Low-level service for compiling {@link Component}s into {@link ProtoViewRef ProtoViews}s, which
|
|
||||||
* can later be used to create and render a Component instance.
|
|
||||||
*
|
|
||||||
* Most applications should instead use higher-level {@link DynamicComponentLoader} service, which
|
|
||||||
* both compiles and instantiates a Component.
|
|
||||||
*/
|
|
||||||
export abstract class Compiler {
|
|
||||||
abstract compileInHost(componentType: Type): Promise<HostViewFactoryRef>;
|
|
||||||
abstract clearCache();
|
|
||||||
}
|
|
||||||
|
|
||||||
function isHostViewFactory(type: any): boolean {
|
|
||||||
return type instanceof HostViewFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Injectable()
|
|
||||||
export class Compiler_ extends Compiler {
|
|
||||||
compileInHost(componentType: Type): Promise<HostViewFactoryRef_> {
|
|
||||||
var metadatas = reflector.annotations(componentType);
|
|
||||||
var hostViewFactory = metadatas.find(isHostViewFactory);
|
|
||||||
|
|
||||||
if (isBlank(hostViewFactory)) {
|
|
||||||
throw new BaseException(`No precompiled component ${stringify(componentType)} found`);
|
|
||||||
}
|
|
||||||
return PromiseWrapper.resolve(new HostViewFactoryRef_(hostViewFactory));
|
|
||||||
}
|
|
||||||
|
|
||||||
clearCache() {}
|
|
||||||
}
|
|
|
@ -0,0 +1,93 @@
|
||||||
|
import {Injector} from 'angular2/src/core/di';
|
||||||
|
import {Type, CONST, isPresent, isBlank} from 'angular2/src/facade/lang';
|
||||||
|
import {unimplemented} from 'angular2/src/facade/exceptions';
|
||||||
|
import {ElementRef, ElementRef_} from './element_ref';
|
||||||
|
import {ViewRef, ViewRef_} from './view_ref';
|
||||||
|
import {AppElement} from './element';
|
||||||
|
import {AppViewManager} from './view_manager';
|
||||||
|
import {ChangeDetectorRef} from '../change_detection/change_detection';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents an instance of a Component created via a {@link ComponentFactory}.
|
||||||
|
*
|
||||||
|
* `ComponentRef` provides access to the Component Instance as well other objects related to this
|
||||||
|
* Component Instance and allows you to destroy the Component Instance via the {@link #destroy}
|
||||||
|
* method.
|
||||||
|
*/
|
||||||
|
export abstract class ComponentRef {
|
||||||
|
/**
|
||||||
|
* Location of the Host Element of this Component Instance.
|
||||||
|
*/
|
||||||
|
get location(): ElementRef { return unimplemented(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The injector on which the component instance exists.
|
||||||
|
*/
|
||||||
|
get injector(): Injector { return unimplemented(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The instance of the Component.
|
||||||
|
*/
|
||||||
|
get instance(): any { return unimplemented(); };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link ViewRef} of the Host View of this Component instance.
|
||||||
|
*/
|
||||||
|
get hostView(): ViewRef { return unimplemented(); };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link ChangeDetectorRef} of the Component instance.
|
||||||
|
*/
|
||||||
|
get changeDetectorRef(): ChangeDetectorRef { return unimplemented(); };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The component type.
|
||||||
|
*/
|
||||||
|
get componentType(): Type { return unimplemented(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroys the component instance and all of the data structures associated with it.
|
||||||
|
*/
|
||||||
|
abstract destroy(): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows to register a callback that will be called when the component is destroyed.
|
||||||
|
*/
|
||||||
|
abstract onDestroy(callback: Function): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ComponentRef_ extends ComponentRef {
|
||||||
|
constructor(private _location: AppElement, private _componentType: Type) { super(); }
|
||||||
|
get location(): ElementRef { return this._location.ref; }
|
||||||
|
get injector(): Injector { return this._location.injector; }
|
||||||
|
get instance(): any { return this._location.component; };
|
||||||
|
get hostView(): ViewRef { return this._location.parentView.ref; };
|
||||||
|
get changeDetectorRef(): ChangeDetectorRef { return this.hostView; };
|
||||||
|
get componentType(): Type { return this._componentType; }
|
||||||
|
|
||||||
|
destroy(): void { this._location.parentView.destroy(); }
|
||||||
|
onDestroy(callback: Function): void { this.hostView.onDestroy(callback); }
|
||||||
|
}
|
||||||
|
|
||||||
|
@CONST()
|
||||||
|
export class ComponentFactory {
|
||||||
|
constructor(public selector: string, private _viewFactory: Function,
|
||||||
|
private _componentType: Type) {}
|
||||||
|
|
||||||
|
get componentType(): Type { return this._componentType; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new component.
|
||||||
|
*/
|
||||||
|
create(injector: Injector, projectableNodes: any[][] = null,
|
||||||
|
rootSelectorOrNode: string | any = null): ComponentRef {
|
||||||
|
var vm: AppViewManager = injector.get(AppViewManager);
|
||||||
|
if (isBlank(projectableNodes)) {
|
||||||
|
projectableNodes = [];
|
||||||
|
}
|
||||||
|
// Note: Host views don't need a declarationAppElement!
|
||||||
|
var hostView = this._viewFactory(vm, injector, null);
|
||||||
|
var hostElement = hostView.create(projectableNodes, rootSelectorOrNode);
|
||||||
|
return new ComponentRef_(hostElement, this._componentType);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
import {Injectable} from 'angular2/src/core/di';
|
||||||
|
import {Type, isBlank, stringify} from 'angular2/src/facade/lang';
|
||||||
|
import {BaseException} from 'angular2/src/facade/exceptions';
|
||||||
|
import {PromiseWrapper} from 'angular2/src/facade/async';
|
||||||
|
import {reflector} from 'angular2/src/core/reflection/reflection';
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
export abstract class ComponentResolver {
|
||||||
|
abstract resolveComponent(componentType: Type): Promise<ComponentFactory>;
|
||||||
|
abstract clearCache();
|
||||||
|
}
|
||||||
|
|
||||||
|
function _isComponentFactory(type: any): boolean {
|
||||||
|
return type instanceof ComponentFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class ReflectorComponentResolver extends ComponentResolver {
|
||||||
|
resolveComponent(componentType: Type): Promise<ComponentFactory> {
|
||||||
|
var metadatas = reflector.annotations(componentType);
|
||||||
|
var componentFactory = metadatas.find(_isComponentFactory);
|
||||||
|
|
||||||
|
if (isBlank(componentFactory)) {
|
||||||
|
throw new BaseException(`No precompiled component ${stringify(componentType)} found`);
|
||||||
|
}
|
||||||
|
return PromiseWrapper.resolve(componentFactory);
|
||||||
|
}
|
||||||
|
clearCache() {}
|
||||||
|
}
|
|
@ -1,91 +1,9 @@
|
||||||
import {Key, Injector, ResolvedProvider, Provider, provide, Injectable} from 'angular2/src/core/di';
|
import {Key, Injector, ResolvedProvider, Provider, provide, Injectable} from 'angular2/src/core/di';
|
||||||
import {Compiler} from './compiler';
|
import {ComponentResolver} from './component_resolver';
|
||||||
import {isType, Type, stringify, isPresent} from 'angular2/src/facade/lang';
|
import {isType, Type, stringify, isPresent} from 'angular2/src/facade/lang';
|
||||||
import {AppViewManager} from 'angular2/src/core/linker/view_manager';
|
import {AppViewManager} from 'angular2/src/core/linker/view_manager';
|
||||||
import {ElementRef, ElementRef_} from './element_ref';
|
import {ElementRef, ElementRef_} from './element_ref';
|
||||||
import {HostViewRef} from './view_ref';
|
import {ComponentRef} from './component_factory';
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents an instance of a Component created via {@link DynamicComponentLoader}.
|
|
||||||
*
|
|
||||||
* `ComponentRef` provides access to the Component Instance as well other objects related to this
|
|
||||||
* Component Instance and allows you to destroy the Component Instance via the {@link #dispose}
|
|
||||||
* method.
|
|
||||||
*/
|
|
||||||
export abstract class ComponentRef {
|
|
||||||
/**
|
|
||||||
* The injector provided {@link DynamicComponentLoader#loadAsRoot}.
|
|
||||||
*
|
|
||||||
* TODO(i): this api is useless and should be replaced by an injector retrieved from
|
|
||||||
* the HostElementRef, which is currently not possible.
|
|
||||||
*/
|
|
||||||
injector: Injector;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Location of the Host Element of this Component Instance.
|
|
||||||
*/
|
|
||||||
location: ElementRef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The instance of the Component.
|
|
||||||
*/
|
|
||||||
instance: any;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The user defined component type, represented via the constructor function.
|
|
||||||
*
|
|
||||||
* <!-- TODO: customize wording for Dart docs -->
|
|
||||||
*/
|
|
||||||
componentType: Type;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The {@link ViewRef} of the Host View of this Component instance.
|
|
||||||
*/
|
|
||||||
get hostView(): HostViewRef {
|
|
||||||
return (<ElementRef_>this.location).internalElement.parentView.ref;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*
|
|
||||||
* The instance of the component.
|
|
||||||
*
|
|
||||||
* TODO(i): this api should be removed
|
|
||||||
*/
|
|
||||||
get hostComponent(): any { return this.instance; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destroys the component instance and all of the data structures associated with it.
|
|
||||||
*
|
|
||||||
* TODO(i): rename to destroy to be consistent with AppViewManager and ViewContainerRef
|
|
||||||
*/
|
|
||||||
abstract dispose(): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class ComponentRef_ extends ComponentRef {
|
|
||||||
/**
|
|
||||||
* TODO(i): refactor into public/private fields
|
|
||||||
*/
|
|
||||||
constructor(location: ElementRef, instance: any, componentType: Type, injector: Injector,
|
|
||||||
private _dispose: () => void) {
|
|
||||||
super();
|
|
||||||
this.location = location;
|
|
||||||
this.instance = instance;
|
|
||||||
this.componentType = componentType;
|
|
||||||
this.injector = injector;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*
|
|
||||||
* Returns the type of this Component instance.
|
|
||||||
*
|
|
||||||
* TODO(i): this api should be removed
|
|
||||||
*/
|
|
||||||
get hostComponentType(): Type { return this.componentType; }
|
|
||||||
|
|
||||||
dispose(): void { this._dispose(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service for instantiating a Component and attaching it to a View at a specified location.
|
* Service for instantiating a Component and attaching it to a View at a specified location.
|
||||||
|
@ -140,7 +58,7 @@ export abstract class DynamicComponentLoader {
|
||||||
* </my-app>
|
* </my-app>
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
abstract loadAsRoot(type: Type, overrideSelector: string, injector: Injector,
|
abstract loadAsRoot(type: Type, overrideSelectorOrNode: string | any, injector: Injector,
|
||||||
onDispose?: () => void, projectableNodes?: any[][]): Promise<ComponentRef>;
|
onDispose?: () => void, projectableNodes?: any[][]): Promise<ComponentRef>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -240,23 +158,20 @@ export abstract class DynamicComponentLoader {
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class DynamicComponentLoader_ extends DynamicComponentLoader {
|
export class DynamicComponentLoader_ extends DynamicComponentLoader {
|
||||||
constructor(private _compiler: Compiler, private _viewManager: AppViewManager) { super(); }
|
constructor(private _compiler: ComponentResolver, private _viewManager: AppViewManager) {
|
||||||
|
super();
|
||||||
loadAsRoot(type: Type, overrideSelector: string, injector: Injector, onDispose?: () => void,
|
|
||||||
projectableNodes?: any[][]): Promise<ComponentRef> {
|
|
||||||
return this._compiler.compileInHost(type).then(hostProtoViewRef => {
|
|
||||||
var hostViewRef = this._viewManager.createRootHostView(hostProtoViewRef, overrideSelector,
|
|
||||||
injector, projectableNodes);
|
|
||||||
var newLocation = this._viewManager.getHostElement(hostViewRef);
|
|
||||||
var component = this._viewManager.getComponent(newLocation);
|
|
||||||
|
|
||||||
var dispose = () => {
|
|
||||||
if (isPresent(onDispose)) {
|
|
||||||
onDispose();
|
|
||||||
}
|
}
|
||||||
this._viewManager.destroyRootHostView(hostViewRef);
|
|
||||||
};
|
loadAsRoot(type: Type, overrideSelectorOrNode: string | any, injector: Injector,
|
||||||
return new ComponentRef_(newLocation, component, type, injector, dispose);
|
onDispose?: () => void, projectableNodes?: any[][]): Promise<ComponentRef> {
|
||||||
|
return this._compiler.resolveComponent(type).then(componentFactory => {
|
||||||
|
var componentRef = componentFactory.create(
|
||||||
|
injector, projectableNodes,
|
||||||
|
isPresent(overrideSelectorOrNode) ? overrideSelectorOrNode : componentFactory.selector);
|
||||||
|
if (isPresent(onDispose)) {
|
||||||
|
componentRef.onDestroy(onDispose);
|
||||||
|
}
|
||||||
|
return componentRef;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,20 +185,10 @@ export class DynamicComponentLoader_ extends DynamicComponentLoader {
|
||||||
|
|
||||||
loadNextToLocation(type: Type, location: ElementRef, providers: ResolvedProvider[] = null,
|
loadNextToLocation(type: Type, location: ElementRef, providers: ResolvedProvider[] = null,
|
||||||
projectableNodes: any[][] = null): Promise<ComponentRef> {
|
projectableNodes: any[][] = null): Promise<ComponentRef> {
|
||||||
return this._compiler.compileInHost(type).then(hostProtoViewRef => {
|
return this._compiler.resolveComponent(type).then(componentFactory => {
|
||||||
var viewContainer = this._viewManager.getViewContainer(location);
|
var viewContainer = this._viewManager.getViewContainer(location);
|
||||||
var hostViewRef = viewContainer.createHostView(hostProtoViewRef, viewContainer.length,
|
return viewContainer.createComponent(componentFactory, viewContainer.length, providers,
|
||||||
providers, projectableNodes);
|
projectableNodes);
|
||||||
var newLocation = this._viewManager.getHostElement(hostViewRef);
|
|
||||||
var component = this._viewManager.getComponent(newLocation);
|
|
||||||
|
|
||||||
var dispose = () => {
|
|
||||||
var index = viewContainer.indexOf(hostViewRef);
|
|
||||||
if (!hostViewRef.destroyed && index !== -1) {
|
|
||||||
viewContainer.remove(index);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return new ComponentRef_(newLocation, component, type, null, dispose);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ export class AppElement {
|
||||||
if (isPresent(refRenderNode)) {
|
if (isPresent(refRenderNode)) {
|
||||||
view.renderer.attachViewAfter(refRenderNode, view.flatRootNodes);
|
view.renderer.attachViewAfter(refRenderNode, view.flatRootNodes);
|
||||||
}
|
}
|
||||||
this.parentView.addRenderContentChild(view);
|
view.addToContentChildren(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
detachView(viewIndex: number): AppView<any> {
|
detachView(viewIndex: number): AppView<any> {
|
||||||
|
@ -92,7 +92,7 @@ export class AppElement {
|
||||||
|
|
||||||
view.renderer.detachView(view.flatRootNodes);
|
view.renderer.detachView(view.flatRootNodes);
|
||||||
|
|
||||||
view.renderParent.removeContentChild(view);
|
view.removeFromContentChildren(this);
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,15 +2,14 @@ import {unimplemented} from 'angular2/src/facade/exceptions';
|
||||||
import {AppElement} from './element';
|
import {AppElement} from './element';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a location in a View that has an injection, change-detection and render context
|
* A wrapper around a native element inside of a View.
|
||||||
* associated with it.
|
|
||||||
*
|
|
||||||
* An `ElementRef` is created for each element in the Template that contains a Directive, Component
|
|
||||||
* or data-binding.
|
|
||||||
*
|
*
|
||||||
* An `ElementRef` is backed by a render-specific element. In the browser, this is usually a DOM
|
* An `ElementRef` is backed by a render-specific element. In the browser, this is usually a DOM
|
||||||
* element.
|
* element.
|
||||||
*/
|
*/
|
||||||
|
// Note: We don't expose things like `Injector`, `ViewContainer`, ... here,
|
||||||
|
// i.e. users have to ask for what they need. With that, we can build better analysis tools
|
||||||
|
// and could do better codegen in the future.
|
||||||
export abstract class ElementRef {
|
export abstract class ElementRef {
|
||||||
/**
|
/**
|
||||||
* The underlying native element or `null` if direct access to native elements is not supported
|
* The underlying native element or `null` if direct access to native elements is not supported
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import {ElementRef, ElementRef_} from './element_ref';
|
import {ElementRef, ElementRef_} from './element_ref';
|
||||||
import {AppElement} from './element';
|
import {AppElement} from './element';
|
||||||
import {AppView} from './view';
|
import {AppView} from './view';
|
||||||
|
import {EmbeddedViewRef} from './view_ref';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an Embedded Template that can be used to instantiate Embedded Views.
|
* Represents an Embedded Template that can be used to instantiate Embedded Views.
|
||||||
|
@ -28,16 +29,18 @@ export abstract class TemplateRef {
|
||||||
*/
|
*/
|
||||||
// TODO(i): rename to anchor or location
|
// TODO(i): rename to anchor or location
|
||||||
get elementRef(): ElementRef { return null; }
|
get elementRef(): ElementRef { return null; }
|
||||||
|
|
||||||
|
abstract createEmbeddedView(): EmbeddedViewRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class TemplateRef_ extends TemplateRef {
|
export class TemplateRef_ extends TemplateRef {
|
||||||
constructor(private _appElement: AppElement, private _viewFactory: Function) { super(); }
|
constructor(private _appElement: AppElement, private _viewFactory: Function) { super(); }
|
||||||
|
|
||||||
createEmbeddedView(): AppView<any> {
|
createEmbeddedView(): EmbeddedViewRef {
|
||||||
var view: AppView<any> = this._viewFactory(this._appElement.parentView.viewManager,
|
var view: AppView<any> = this._viewFactory(this._appElement.parentView.viewManager,
|
||||||
this._appElement.parentInjector, this._appElement);
|
this._appElement.parentInjector, this._appElement);
|
||||||
view.create(null, null);
|
view.create(null, null);
|
||||||
return view;
|
return view.ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
get elementRef(): ElementRef { return this._appElement.ref; }
|
get elementRef(): ElementRef { return this._appElement.ref; }
|
||||||
|
|
|
@ -19,12 +19,13 @@ import {
|
||||||
CONST,
|
CONST,
|
||||||
CONST_EXPR,
|
CONST_EXPR,
|
||||||
stringify,
|
stringify,
|
||||||
isPrimitive
|
isPrimitive,
|
||||||
|
isString
|
||||||
} from 'angular2/src/facade/lang';
|
} from 'angular2/src/facade/lang';
|
||||||
|
|
||||||
import {ObservableWrapper} from 'angular2/src/facade/async';
|
import {ObservableWrapper} from 'angular2/src/facade/async';
|
||||||
import {Renderer, RootRenderer, RenderComponentType} from 'angular2/src/core/render/api';
|
import {Renderer, RootRenderer, RenderComponentType} from 'angular2/src/core/render/api';
|
||||||
import {ViewRef_, HostViewFactoryRef} from './view_ref';
|
import {ViewRef_} from './view_ref';
|
||||||
|
|
||||||
import {AppViewManager_, AppViewManager} from './view_manager';
|
import {AppViewManager_, AppViewManager} from './view_manager';
|
||||||
import {ViewType} from './view_type';
|
import {ViewType} from './view_type';
|
||||||
|
@ -50,8 +51,6 @@ import {
|
||||||
import {StaticNodeDebugInfo, DebugContext} from './debug_context';
|
import {StaticNodeDebugInfo, DebugContext} from './debug_context';
|
||||||
import {ElementInjector} from './element_injector';
|
import {ElementInjector} from './element_injector';
|
||||||
|
|
||||||
export const HOST_VIEW_ELEMENT_NAME = '$hostViewEl';
|
|
||||||
|
|
||||||
const EMPTY_CONTEXT = CONST_EXPR(new Object());
|
const EMPTY_CONTEXT = CONST_EXPR(new Object());
|
||||||
|
|
||||||
var _scope_check: WtfScopeFn = wtfCreateScope(`AppView#check(ascii id)`);
|
var _scope_check: WtfScopeFn = wtfCreateScope(`AppView#check(ascii id)`);
|
||||||
|
@ -70,6 +69,7 @@ export abstract class AppView<T> {
|
||||||
contentChildren: AppView<any>[] = [];
|
contentChildren: AppView<any>[] = [];
|
||||||
viewChildren: AppView<any>[] = [];
|
viewChildren: AppView<any>[] = [];
|
||||||
renderParent: AppView<any>;
|
renderParent: AppView<any>;
|
||||||
|
viewContainerElement: AppElement = null;
|
||||||
|
|
||||||
private _literalArrayCache: any[][];
|
private _literalArrayCache: any[][];
|
||||||
private _literalMapCache: Array<{[key: string]: any}>;
|
private _literalMapCache: Array<{[key: string]: any}>;
|
||||||
|
@ -92,6 +92,8 @@ export abstract class AppView<T> {
|
||||||
|
|
||||||
private _currentDebugContext: DebugContext = null;
|
private _currentDebugContext: DebugContext = null;
|
||||||
|
|
||||||
|
private _hasExternalHostElement: boolean;
|
||||||
|
|
||||||
constructor(public clazz: any, public componentType: RenderComponentType, public type: ViewType,
|
constructor(public clazz: any, public componentType: RenderComponentType, public type: ViewType,
|
||||||
public locals: {[key: string]: any}, public viewManager: AppViewManager_,
|
public locals: {[key: string]: any}, public viewManager: AppViewManager_,
|
||||||
public parentInjector: Injector, public declarationAppElement: AppElement,
|
public parentInjector: Injector, public declarationAppElement: AppElement,
|
||||||
|
@ -107,7 +109,7 @@ export abstract class AppView<T> {
|
||||||
this._literalMapCache = ListWrapper.createFixedSize(literalMapCacheSize);
|
this._literalMapCache = ListWrapper.createFixedSize(literalMapCacheSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
create(givenProjectableNodes: Array<any | any[]>, rootSelector: string) {
|
create(givenProjectableNodes: Array<any | any[]>, rootSelectorOrNode: string | any): AppElement {
|
||||||
var context;
|
var context;
|
||||||
var projectableNodes;
|
var projectableNodes;
|
||||||
switch (this.type) {
|
switch (this.type) {
|
||||||
|
@ -126,25 +128,26 @@ export abstract class AppView<T> {
|
||||||
projectableNodes = givenProjectableNodes;
|
projectableNodes = givenProjectableNodes;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
this._hasExternalHostElement = isPresent(rootSelectorOrNode);
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.projectableNodes = projectableNodes;
|
this.projectableNodes = projectableNodes;
|
||||||
if (this.debugMode) {
|
if (this.debugMode) {
|
||||||
this._resetDebug();
|
this._resetDebug();
|
||||||
try {
|
try {
|
||||||
this.createInternal(rootSelector);
|
return this.createInternal(rootSelectorOrNode);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this._rethrowWithContext(e, e.stack);
|
this._rethrowWithContext(e, e.stack);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.createInternal(rootSelector);
|
return this.createInternal(rootSelectorOrNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overwritten by implementations
|
* Overwritten by implementations
|
||||||
*/
|
*/
|
||||||
createInternal(rootSelector: string): void {}
|
createInternal(rootSelectorOrNode: string | any): AppElement { return null; }
|
||||||
|
|
||||||
init(rootNodesOrAppElements: any[], allNodes: any[], appElements: {[key: string]: AppElement},
|
init(rootNodesOrAppElements: any[], allNodes: any[], appElements: {[key: string]: AppElement},
|
||||||
disposables: Function[], subscriptions: any[]) {
|
disposables: Function[], subscriptions: any[]) {
|
||||||
|
@ -162,7 +165,16 @@ export abstract class AppView<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getHostViewElement(): AppElement { return this.namedAppElements[HOST_VIEW_ELEMENT_NAME]; }
|
selectOrCreateHostElement(elementName: string, rootSelectorOrNode: string | any,
|
||||||
|
debugCtx: DebugContext): any {
|
||||||
|
var hostElement;
|
||||||
|
if (isPresent(rootSelectorOrNode)) {
|
||||||
|
hostElement = this.renderer.selectRootElement(rootSelectorOrNode, debugCtx);
|
||||||
|
} else {
|
||||||
|
hostElement = this.renderer.createElement(null, elementName, debugCtx);
|
||||||
|
}
|
||||||
|
return hostElement;
|
||||||
|
}
|
||||||
|
|
||||||
injectorGet(token: any, nodeIndex: number, notFoundResult: any): any {
|
injectorGet(token: any, nodeIndex: number, notFoundResult: any): any {
|
||||||
if (this.debugMode) {
|
if (this.debugMode) {
|
||||||
|
@ -194,16 +206,25 @@ export abstract class AppView<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy() {
|
destroy() {
|
||||||
|
if (this._hasExternalHostElement) {
|
||||||
|
this.renderer.detachView(this.flatRootNodes);
|
||||||
|
} else if (isPresent(this.viewContainerElement)) {
|
||||||
|
this.viewContainerElement.detachView(this.viewContainerElement.nestedViews.indexOf(this));
|
||||||
|
}
|
||||||
|
this._destroyRecurse();
|
||||||
|
}
|
||||||
|
|
||||||
|
private _destroyRecurse() {
|
||||||
if (this.destroyed) {
|
if (this.destroyed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var children = this.contentChildren;
|
var children = this.contentChildren;
|
||||||
for (var i = 0; i < children.length; i++) {
|
for (var i = 0; i < children.length; i++) {
|
||||||
children[i].destroy();
|
children[i]._destroyRecurse();
|
||||||
}
|
}
|
||||||
children = this.viewChildren;
|
children = this.viewChildren;
|
||||||
for (var i = 0; i < children.length; i++) {
|
for (var i = 0; i < children.length; i++) {
|
||||||
children[i].destroy();
|
children[i]._destroyRecurse();
|
||||||
}
|
}
|
||||||
if (this.debugMode) {
|
if (this.debugMode) {
|
||||||
this._resetDebug();
|
this._resetDebug();
|
||||||
|
@ -223,7 +244,6 @@ export abstract class AppView<T> {
|
||||||
private _destroyLocal() {
|
private _destroyLocal() {
|
||||||
var hostElement =
|
var hostElement =
|
||||||
this.type === ViewType.COMPONENT ? this.declarationAppElement.nativeElement : null;
|
this.type === ViewType.COMPONENT ? this.declarationAppElement.nativeElement : null;
|
||||||
this.renderer.destroyView(hostElement, this.allNodes);
|
|
||||||
for (var i = 0; i < this.disposables.length; i++) {
|
for (var i = 0; i < this.disposables.length; i++) {
|
||||||
this.disposables[i]();
|
this.disposables[i]();
|
||||||
}
|
}
|
||||||
|
@ -231,9 +251,15 @@ export abstract class AppView<T> {
|
||||||
ObservableWrapper.dispose(this.subscriptions[i]);
|
ObservableWrapper.dispose(this.subscriptions[i]);
|
||||||
}
|
}
|
||||||
this.destroyInternal();
|
this.destroyInternal();
|
||||||
|
if (this._hasExternalHostElement) {
|
||||||
|
this.renderer.detachView(this.flatRootNodes);
|
||||||
|
} else if (isPresent(this.viewContainerElement)) {
|
||||||
|
this.viewContainerElement.detachView(this.viewContainerElement.nestedViews.indexOf(this));
|
||||||
|
} else {
|
||||||
this.dirtyParentQueriesInternal();
|
this.dirtyParentQueriesInternal();
|
||||||
}
|
}
|
||||||
|
this.renderer.destroyView(hostElement, this.allNodes);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overwritten by implementations
|
* Overwritten by implementations
|
||||||
|
@ -323,6 +349,18 @@ export abstract class AppView<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addToContentChildren(renderAppElement: AppElement): void {
|
||||||
|
renderAppElement.parentView.contentChildren.push(this);
|
||||||
|
this.viewContainerElement = renderAppElement;
|
||||||
|
this.dirtyParentQueriesInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
removeFromContentChildren(renderAppElement: AppElement): void {
|
||||||
|
ListWrapper.remove(renderAppElement.parentView.contentChildren, this);
|
||||||
|
this.dirtyParentQueriesInternal();
|
||||||
|
this.viewContainerElement = null;
|
||||||
|
}
|
||||||
|
|
||||||
literalArray(id: number, value: any[]): any[] {
|
literalArray(id: number, value: any[]): any[] {
|
||||||
var prevValue = this._literalArrayCache[id];
|
var prevValue = this._literalArrayCache[id];
|
||||||
if (isBlank(value)) {
|
if (isBlank(value)) {
|
||||||
|
@ -393,11 +431,6 @@ export abstract class AppView<T> {
|
||||||
throwDestroyedError(details: string): void { throw new ViewDestroyedException(details); }
|
throwDestroyedError(details: string): void { throw new ViewDestroyedException(details); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@CONST()
|
|
||||||
export class HostViewFactory {
|
|
||||||
constructor(public selector: string, public viewFactory: Function) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
function _findLastRenderNode(node: any): any {
|
function _findLastRenderNode(node: any): any {
|
||||||
var lastNode;
|
var lastNode;
|
||||||
if (node instanceof AppElement) {
|
if (node instanceof AppElement) {
|
||||||
|
|
|
@ -9,21 +9,14 @@ import {AppElement} from './element';
|
||||||
|
|
||||||
import {ElementRef, ElementRef_} from './element_ref';
|
import {ElementRef, ElementRef_} from './element_ref';
|
||||||
import {TemplateRef, TemplateRef_} from './template_ref';
|
import {TemplateRef, TemplateRef_} from './template_ref';
|
||||||
import {
|
import {EmbeddedViewRef, ViewRef, ViewRef_} from './view_ref';
|
||||||
EmbeddedViewRef,
|
import {ComponentFactory, ComponentRef} from './component_factory';
|
||||||
HostViewRef,
|
|
||||||
HostViewFactoryRef,
|
|
||||||
HostViewFactoryRef_,
|
|
||||||
ViewRef,
|
|
||||||
ViewRef_
|
|
||||||
} from './view_ref';
|
|
||||||
import {AppView} from './view';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a container where one or more Views can be attached.
|
* Represents a container where one or more Views can be attached.
|
||||||
*
|
*
|
||||||
* The container can contain two kinds of Views. Host Views, created by instantiating a
|
* The container can contain two kinds of Views. Host Views, created by instantiating a
|
||||||
* {@link Component} via {@link #createHostView}, and Embedded Views, created by instantiating an
|
* {@link Component} via {@link #createComponent}, and Embedded Views, created by instantiating an
|
||||||
* {@link TemplateRef Embedded Template} via {@link #createEmbeddedView}.
|
* {@link TemplateRef Embedded Template} via {@link #createEmbeddedView}.
|
||||||
*
|
*
|
||||||
* The location of the View Container within the containing View is specified by the Anchor
|
* The location of the View Container within the containing View is specified by the Anchor
|
||||||
|
@ -83,11 +76,11 @@ export abstract class ViewContainerRef {
|
||||||
* You can optionally specify `dynamicallyCreatedProviders`, which configure the {@link Injector}
|
* You can optionally specify `dynamicallyCreatedProviders`, which configure the {@link Injector}
|
||||||
* that will be created for the Host View.
|
* that will be created for the Host View.
|
||||||
*
|
*
|
||||||
* Returns the {@link HostViewRef} of the Host View created for the newly instantiated Component.
|
* Returns the {@link ComponentRef} of the Host View created for the newly instantiated Component.
|
||||||
*/
|
*/
|
||||||
abstract createHostView(hostViewFactoryRef: HostViewFactoryRef, index?: number,
|
abstract createComponent(componentFactory: ComponentFactory, index?: number,
|
||||||
dynamicallyCreatedProviders?: ResolvedProvider[],
|
dynamicallyCreatedProviders?: ResolvedProvider[],
|
||||||
projectableNodes?: any[][]): HostViewRef;
|
projectableNodes?: any[][]): ComponentRef;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inserts a View identified by a {@link ViewRef} into the container at the specified `index`.
|
* Inserts a View identified by a {@link ViewRef} into the container at the specified `index`.
|
||||||
|
@ -130,45 +123,32 @@ export class ViewContainerRef_ implements ViewContainerRef {
|
||||||
|
|
||||||
get element(): ElementRef { return this._element.ref; }
|
get element(): ElementRef { return this._element.ref; }
|
||||||
|
|
||||||
/** @internal */
|
|
||||||
_createEmbeddedViewInContainerScope: WtfScopeFn =
|
|
||||||
wtfCreateScope('ViewContainerRef#createEmbeddedView()');
|
|
||||||
|
|
||||||
// TODO(rado): profile and decide whether bounds checks should be added
|
// TODO(rado): profile and decide whether bounds checks should be added
|
||||||
// to the methods below.
|
// to the methods below.
|
||||||
createEmbeddedView(templateRef: TemplateRef, index: number = -1): EmbeddedViewRef {
|
createEmbeddedView(templateRef: TemplateRef, index: number = -1): EmbeddedViewRef {
|
||||||
var s = this._createEmbeddedViewInContainerScope();
|
var viewRef: EmbeddedViewRef = templateRef.createEmbeddedView();
|
||||||
if (index == -1) index = this.length;
|
this.insert(viewRef, index);
|
||||||
var templateRef_ = (<TemplateRef_>templateRef);
|
return viewRef;
|
||||||
var view: AppView<any> = templateRef_.createEmbeddedView();
|
|
||||||
this._element.attachView(view, index);
|
|
||||||
return wtfLeave(s, view.ref);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
_createHostViewInContainerScope: WtfScopeFn = wtfCreateScope('ViewContainerRef#createHostView()');
|
_createComponentInContainerScope: WtfScopeFn =
|
||||||
|
wtfCreateScope('ViewContainerRef#createComponent()');
|
||||||
|
|
||||||
createHostView(hostViewFactoryRef: HostViewFactoryRef, index: number = -1,
|
createComponent(componentFactory: ComponentFactory, index: number = -1,
|
||||||
dynamicallyCreatedProviders: ResolvedProvider[] = null,
|
dynamicallyCreatedProviders: ResolvedProvider[] = null,
|
||||||
projectableNodes: any[][] = null): HostViewRef {
|
projectableNodes: any[][] = null): ComponentRef {
|
||||||
var s = this._createHostViewInContainerScope();
|
var s = this._createComponentInContainerScope();
|
||||||
if (index == -1) index = this.length;
|
|
||||||
var contextEl = this._element;
|
|
||||||
var contextInjector = this._element.parentInjector;
|
var contextInjector = this._element.parentInjector;
|
||||||
|
|
||||||
var hostViewFactory = (<HostViewFactoryRef_>hostViewFactoryRef).internalHostViewFactory;
|
|
||||||
|
|
||||||
var childInjector =
|
var childInjector =
|
||||||
isPresent(dynamicallyCreatedProviders) && dynamicallyCreatedProviders.length > 0 ?
|
isPresent(dynamicallyCreatedProviders) && dynamicallyCreatedProviders.length > 0 ?
|
||||||
new Injector_(ProtoInjector.fromResolvedProviders(dynamicallyCreatedProviders),
|
new Injector_(ProtoInjector.fromResolvedProviders(dynamicallyCreatedProviders),
|
||||||
contextInjector) :
|
contextInjector) :
|
||||||
contextInjector;
|
contextInjector;
|
||||||
|
var componentRef = componentFactory.create(childInjector, projectableNodes);
|
||||||
var view =
|
this.insert(componentRef.hostView, index);
|
||||||
hostViewFactory.viewFactory(contextEl.parentView.viewManager, childInjector, contextEl);
|
return wtfLeave(s, componentRef);
|
||||||
view.create(projectableNodes, null);
|
|
||||||
this._element.attachView(view, index);
|
|
||||||
return wtfLeave(s, view.ref);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
|
|
|
@ -9,20 +9,10 @@ import {
|
||||||
import {isPresent, isBlank, isArray, Type} from 'angular2/src/facade/lang';
|
import {isPresent, isBlank, isArray, Type} from 'angular2/src/facade/lang';
|
||||||
import {BaseException} from 'angular2/src/facade/exceptions';
|
import {BaseException} from 'angular2/src/facade/exceptions';
|
||||||
import {ElementRef, ElementRef_} from './element_ref';
|
import {ElementRef, ElementRef_} from './element_ref';
|
||||||
import {
|
|
||||||
HostViewFactoryRef,
|
|
||||||
HostViewFactoryRef_,
|
|
||||||
EmbeddedViewRef,
|
|
||||||
HostViewRef,
|
|
||||||
ViewRef,
|
|
||||||
ViewRef_
|
|
||||||
} from './view_ref';
|
|
||||||
import {ViewContainerRef, ViewContainerRef_} from './view_container_ref';
|
import {ViewContainerRef, ViewContainerRef_} from './view_container_ref';
|
||||||
import {RootRenderer, RenderComponentType, Renderer} from 'angular2/src/core/render/api';
|
import {RootRenderer, RenderComponentType, Renderer} from 'angular2/src/core/render/api';
|
||||||
import {wtfCreateScope, wtfLeave, WtfScopeFn} from '../profile/profile';
|
|
||||||
import {APP_ID} from 'angular2/src/core/application_tokens';
|
import {APP_ID} from 'angular2/src/core/application_tokens';
|
||||||
import {ViewEncapsulation} from 'angular2/src/core/metadata/view';
|
import {ViewEncapsulation} from 'angular2/src/core/metadata/view';
|
||||||
import {ViewType} from './view_type';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service exposing low level API for creating, moving and destroying Views.
|
* Service exposing low level API for creating, moving and destroying Views.
|
||||||
|
@ -36,11 +26,6 @@ export abstract class AppViewManager {
|
||||||
*/
|
*/
|
||||||
abstract getViewContainer(location: ElementRef): ViewContainerRef;
|
abstract getViewContainer(location: ElementRef): ViewContainerRef;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the {@link ElementRef} that makes up the specified Host View.
|
|
||||||
*/
|
|
||||||
abstract getHostElement(hostViewRef: HostViewRef): ElementRef;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches the Component View of the Component specified via `hostLocation` and returns the
|
* Searches the Component View of the Component specified via `hostLocation` and returns the
|
||||||
* {@link ElementRef} for the Element identified via a Variable Name `variableName`.
|
* {@link ElementRef} for the Element identified via a Variable Name `variableName`.
|
||||||
|
@ -50,75 +35,6 @@ export abstract class AppViewManager {
|
||||||
*/
|
*/
|
||||||
abstract getNamedElementInComponentView(hostLocation: ElementRef,
|
abstract getNamedElementInComponentView(hostLocation: ElementRef,
|
||||||
variableName: string): ElementRef;
|
variableName: string): ElementRef;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the component instance for the provided Host Element.
|
|
||||||
*/
|
|
||||||
abstract getComponent(hostLocation: ElementRef): any;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates an instance of a Component and attaches it to the first element in the global View
|
|
||||||
* (usually DOM Document) that matches the component's selector or `overrideSelector`.
|
|
||||||
*
|
|
||||||
* This as a low-level way to bootstrap an application and upgrade an existing Element to a
|
|
||||||
* Host Element. Most applications should use {@link DynamicComponentLoader#loadAsRoot} instead.
|
|
||||||
*
|
|
||||||
* The Component and its View are created based on the `hostProtoComponentRef` which can be
|
|
||||||
* obtained
|
|
||||||
* by compiling the component with {@link Compiler#compileInHost}.
|
|
||||||
*
|
|
||||||
* Use {@link AppViewManager#destroyRootHostView} to destroy the created Component and it's Host
|
|
||||||
* View.
|
|
||||||
*
|
|
||||||
* ### Example
|
|
||||||
*
|
|
||||||
* ```
|
|
||||||
* @ng.Component({
|
|
||||||
* selector: 'child-component'
|
|
||||||
* })
|
|
||||||
* @ng.View({
|
|
||||||
* template: 'Child'
|
|
||||||
* })
|
|
||||||
* class ChildComponent {
|
|
||||||
*
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* @ng.Component({
|
|
||||||
* selector: 'my-app'
|
|
||||||
* })
|
|
||||||
* @ng.View({
|
|
||||||
* template: `
|
|
||||||
* Parent (<some-component></some-component>)
|
|
||||||
* `
|
|
||||||
* })
|
|
||||||
* class MyApp implements OnDestroy {
|
|
||||||
* viewRef: ng.ViewRef;
|
|
||||||
*
|
|
||||||
* constructor(public appViewManager: ng.AppViewManager, compiler: ng.Compiler) {
|
|
||||||
* compiler.compileInHost(ChildComponent).then((protoView: ng.ProtoComponentRef) => {
|
|
||||||
* this.viewRef = appViewManager.createRootHostView(protoView, 'some-component', null);
|
|
||||||
* })
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* ngOnDestroy() {
|
|
||||||
* this.appViewManager.destroyRootHostView(this.viewRef);
|
|
||||||
* this.viewRef = null;
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* ng.bootstrap(MyApp);
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
abstract createRootHostView(hostViewFactoryRef: HostViewFactoryRef, overrideSelector: string,
|
|
||||||
injector: Injector, projectableNodes?: any[][]): HostViewRef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destroys the Host View created via {@link AppViewManager#createRootHostView}.
|
|
||||||
*
|
|
||||||
* Along with the Host View, the Component Instance as well as all nested View and Components are
|
|
||||||
* destroyed as well.
|
|
||||||
*/
|
|
||||||
abstract destroyRootHostView(hostViewRef: HostViewRef);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
@ -131,14 +47,6 @@ export class AppViewManager_ extends AppViewManager {
|
||||||
return (<ElementRef_>location).internalElement.vcRef;
|
return (<ElementRef_>location).internalElement.vcRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
getHostElement(hostViewRef: ViewRef): ElementRef {
|
|
||||||
var hostView = (<ViewRef_>hostViewRef).internalView;
|
|
||||||
if (hostView.type !== ViewType.HOST) {
|
|
||||||
throw new BaseException('This operation is only allowed on host views');
|
|
||||||
}
|
|
||||||
return hostView.getHostViewElement().ref;
|
|
||||||
}
|
|
||||||
|
|
||||||
getNamedElementInComponentView(hostLocation: ElementRef, variableName: string): ElementRef {
|
getNamedElementInComponentView(hostLocation: ElementRef, variableName: string): ElementRef {
|
||||||
var appEl = (<ElementRef_>hostLocation).internalElement;
|
var appEl = (<ElementRef_>hostLocation).internalElement;
|
||||||
var componentView = appEl.componentView;
|
var componentView = appEl.componentView;
|
||||||
|
@ -152,34 +60,6 @@ export class AppViewManager_ extends AppViewManager {
|
||||||
throw new BaseException(`Could not find variable ${variableName}`);
|
throw new BaseException(`Could not find variable ${variableName}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
getComponent(hostLocation: ElementRef): any {
|
|
||||||
return (<ElementRef_>hostLocation).internalElement.component;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @internal */
|
|
||||||
_createRootHostViewScope: WtfScopeFn = wtfCreateScope('AppViewManager#createRootHostView()');
|
|
||||||
|
|
||||||
createRootHostView(hostViewFactoryRef: HostViewFactoryRef, overrideSelector: string,
|
|
||||||
injector: Injector, projectableNodes: any[][] = null): HostViewRef {
|
|
||||||
var s = this._createRootHostViewScope();
|
|
||||||
var hostViewFactory = (<HostViewFactoryRef_>hostViewFactoryRef).internalHostViewFactory;
|
|
||||||
var selector = isPresent(overrideSelector) ? overrideSelector : hostViewFactory.selector;
|
|
||||||
var view = hostViewFactory.viewFactory(this, injector, null);
|
|
||||||
view.create(projectableNodes, selector);
|
|
||||||
return wtfLeave(s, view.ref);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @internal */
|
|
||||||
_destroyRootHostViewScope: WtfScopeFn = wtfCreateScope('AppViewManager#destroyRootHostView()');
|
|
||||||
|
|
||||||
destroyRootHostView(hostViewRef: ViewRef) {
|
|
||||||
var s = this._destroyRootHostViewScope();
|
|
||||||
var hostView = (<ViewRef_>hostViewRef).internalView;
|
|
||||||
hostView.renderer.detachView(hostView.flatRootNodes);
|
|
||||||
hostView.destroy();
|
|
||||||
wtfLeave(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used by the generated code
|
* Used by the generated code
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import {unimplemented} from 'angular2/src/facade/exceptions';
|
import {unimplemented} from 'angular2/src/facade/exceptions';
|
||||||
|
import {isPresent} from 'angular2/src/facade/lang';
|
||||||
import {ChangeDetectorRef} from '../change_detection/change_detector_ref';
|
import {ChangeDetectorRef} from '../change_detection/change_detector_ref';
|
||||||
import {AppView, HostViewFactory} from './view';
|
import {AppView} from './view';
|
||||||
import {ChangeDetectionStrategy} from 'angular2/src/core/change_detection/constants';
|
import {ChangeDetectionStrategy} from 'angular2/src/core/change_detection/constants';
|
||||||
|
|
||||||
export abstract class ViewRef extends ChangeDetectorRef {
|
export abstract class ViewRef extends ChangeDetectorRef {
|
||||||
|
@ -10,19 +11,8 @@ export abstract class ViewRef extends ChangeDetectorRef {
|
||||||
get changeDetectorRef(): ChangeDetectorRef { return <ChangeDetectorRef>unimplemented(); };
|
get changeDetectorRef(): ChangeDetectorRef { return <ChangeDetectorRef>unimplemented(); };
|
||||||
|
|
||||||
get destroyed(): boolean { return <boolean>unimplemented(); }
|
get destroyed(): boolean { return <boolean>unimplemented(); }
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
abstract onDestroy(callback: Function);
|
||||||
* Represents a View containing a single Element that is the Host Element of a {@link Component}
|
|
||||||
* instance.
|
|
||||||
*
|
|
||||||
* A Host View is created for every dynamically created Component that was compiled on its own (as
|
|
||||||
* opposed to as a part of another Component's Template) via {@link Compiler#compileInHost} or one
|
|
||||||
* of the higher-level APIs: {@link AppViewManager#createRootHostView},
|
|
||||||
* {@link AppViewManager#createHostViewInContainer}, {@link ViewContainerRef#createHostView}.
|
|
||||||
*/
|
|
||||||
export abstract class HostViewRef extends ViewRef {
|
|
||||||
get rootNodes(): any[] { return <any[]>unimplemented(); };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -90,9 +80,14 @@ export abstract class EmbeddedViewRef extends ViewRef {
|
||||||
abstract hasLocal(variableName: string): boolean;
|
abstract hasLocal(variableName: string): boolean;
|
||||||
|
|
||||||
get rootNodes(): any[] { return <any[]>unimplemented(); };
|
get rootNodes(): any[] { return <any[]>unimplemented(); };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroys the view and all of the data structures associated with it.
|
||||||
|
*/
|
||||||
|
abstract destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ViewRef_ implements EmbeddedViewRef, HostViewRef {
|
export class ViewRef_ implements EmbeddedViewRef {
|
||||||
constructor(private _view: AppView<any>) { this._view = _view; }
|
constructor(private _view: AppView<any>) { this._view = _view; }
|
||||||
|
|
||||||
get internalView(): AppView<any> { return this._view; }
|
get internalView(): AppView<any> { return this._view; }
|
||||||
|
@ -118,12 +113,8 @@ export class ViewRef_ implements EmbeddedViewRef, HostViewRef {
|
||||||
this._view.cdMode = ChangeDetectionStrategy.CheckAlways;
|
this._view.cdMode = ChangeDetectionStrategy.CheckAlways;
|
||||||
this.markForCheck();
|
this.markForCheck();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
onDestroy(callback: Function) { this._view.disposables.push(callback); }
|
||||||
export abstract class HostViewFactoryRef {}
|
|
||||||
|
destroy() { this._view.destroy(); }
|
||||||
export class HostViewFactoryRef_ implements HostViewFactoryRef {
|
|
||||||
constructor(private _hostViewFactory: HostViewFactory) {}
|
|
||||||
|
|
||||||
get internalHostViewFactory(): HostViewFactory { return this._hostViewFactory; }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,7 +146,7 @@ export interface ViewDecorator extends TypeDecorator {
|
||||||
* ]
|
* ]
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
export interface DirectiveFactory {
|
export interface DirectiveMetadataFactory {
|
||||||
(obj: {
|
(obj: {
|
||||||
selector?: string,
|
selector?: string,
|
||||||
inputs?: string[],
|
inputs?: string[],
|
||||||
|
@ -204,7 +204,7 @@ export interface DirectiveFactory {
|
||||||
* ]
|
* ]
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
export interface ComponentFactory {
|
export interface ComponentMetadataFactory {
|
||||||
(obj: {
|
(obj: {
|
||||||
selector?: string,
|
selector?: string,
|
||||||
inputs?: string[],
|
inputs?: string[],
|
||||||
|
@ -298,7 +298,7 @@ export interface ComponentFactory {
|
||||||
* ]
|
* ]
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
export interface ViewFactory {
|
export interface ViewMetadataFactory {
|
||||||
(obj: {
|
(obj: {
|
||||||
templateUrl?: string,
|
templateUrl?: string,
|
||||||
template?: string,
|
template?: string,
|
||||||
|
@ -353,7 +353,7 @@ export interface ViewFactory {
|
||||||
* ]
|
* ]
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
export interface AttributeFactory {
|
export interface AttributeMetadataFactory {
|
||||||
(name: string): TypeDecorator;
|
(name: string): TypeDecorator;
|
||||||
new (name: string): AttributeMetadata;
|
new (name: string): AttributeMetadata;
|
||||||
}
|
}
|
||||||
|
@ -401,7 +401,7 @@ export interface AttributeFactory {
|
||||||
* ]
|
* ]
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
export interface QueryFactory {
|
export interface QueryMetadataFactory {
|
||||||
(selector: Type | string, {descendants}?: {descendants?: boolean}): ParameterDecorator;
|
(selector: Type | string, {descendants}?: {descendants?: boolean}): ParameterDecorator;
|
||||||
new (selector: Type | string, {descendants}?: {descendants?: boolean}): QueryMetadata;
|
new (selector: Type | string, {descendants}?: {descendants?: boolean}): QueryMetadata;
|
||||||
}
|
}
|
||||||
|
@ -409,7 +409,7 @@ export interface QueryFactory {
|
||||||
/**
|
/**
|
||||||
* Factory for {@link ContentChildren}.
|
* Factory for {@link ContentChildren}.
|
||||||
*/
|
*/
|
||||||
export interface ContentChildrenFactory {
|
export interface ContentChildrenMetadataFactory {
|
||||||
(selector: Type | string, {descendants}?: {descendants?: boolean}): any;
|
(selector: Type | string, {descendants}?: {descendants?: boolean}): any;
|
||||||
new (selector: Type | string, {descendants}?: {descendants?: boolean}): ContentChildrenMetadata;
|
new (selector: Type | string, {descendants}?: {descendants?: boolean}): ContentChildrenMetadata;
|
||||||
}
|
}
|
||||||
|
@ -417,15 +417,15 @@ export interface ContentChildrenFactory {
|
||||||
/**
|
/**
|
||||||
* Factory for {@link ContentChild}.
|
* Factory for {@link ContentChild}.
|
||||||
*/
|
*/
|
||||||
export interface ContentChildFactory {
|
export interface ContentChildMetadataFactory {
|
||||||
(selector: Type | string): any;
|
(selector: Type | string): any;
|
||||||
new (selector: Type | string): ContentChildFactory;
|
new (selector: Type | string): ContentChildMetadataFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Factory for {@link ViewChildren}.
|
* Factory for {@link ViewChildren}.
|
||||||
*/
|
*/
|
||||||
export interface ViewChildrenFactory {
|
export interface ViewChildrenMetadataFactory {
|
||||||
(selector: Type | string): any;
|
(selector: Type | string): any;
|
||||||
new (selector: Type | string): ViewChildrenMetadata;
|
new (selector: Type | string): ViewChildrenMetadata;
|
||||||
}
|
}
|
||||||
|
@ -433,9 +433,9 @@ export interface ViewChildrenFactory {
|
||||||
/**
|
/**
|
||||||
* Factory for {@link ViewChild}.
|
* Factory for {@link ViewChild}.
|
||||||
*/
|
*/
|
||||||
export interface ViewChildFactory {
|
export interface ViewChildMetadataFactory {
|
||||||
(selector: Type | string): any;
|
(selector: Type | string): any;
|
||||||
new (selector: Type | string): ViewChildFactory;
|
new (selector: Type | string): ViewChildMetadataFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -446,7 +446,7 @@ export interface ViewChildFactory {
|
||||||
*
|
*
|
||||||
* {@example core/ts/metadata/metadata.ts region='pipe'}
|
* {@example core/ts/metadata/metadata.ts region='pipe'}
|
||||||
*/
|
*/
|
||||||
export interface PipeFactory {
|
export interface PipeMetadataFactory {
|
||||||
(obj: {name: string, pure?: boolean}): any;
|
(obj: {name: string, pure?: boolean}): any;
|
||||||
new (obj: {name: string, pure?: boolean}): any;
|
new (obj: {name: string, pure?: boolean}): any;
|
||||||
}
|
}
|
||||||
|
@ -456,7 +456,7 @@ export interface PipeFactory {
|
||||||
*
|
*
|
||||||
* See {@link InputMetadata}.
|
* See {@link InputMetadata}.
|
||||||
*/
|
*/
|
||||||
export interface InputFactory {
|
export interface InputMetadataFactory {
|
||||||
(bindingPropertyName?: string): any;
|
(bindingPropertyName?: string): any;
|
||||||
new (bindingPropertyName?: string): any;
|
new (bindingPropertyName?: string): any;
|
||||||
}
|
}
|
||||||
|
@ -466,7 +466,7 @@ export interface InputFactory {
|
||||||
*
|
*
|
||||||
* See {@link OutputMetadata}.
|
* See {@link OutputMetadata}.
|
||||||
*/
|
*/
|
||||||
export interface OutputFactory {
|
export interface OutputMetadataFactory {
|
||||||
(bindingPropertyName?: string): any;
|
(bindingPropertyName?: string): any;
|
||||||
new (bindingPropertyName?: string): any;
|
new (bindingPropertyName?: string): any;
|
||||||
}
|
}
|
||||||
|
@ -474,7 +474,7 @@ export interface OutputFactory {
|
||||||
/**
|
/**
|
||||||
* {@link HostBindingMetadata} factory function.
|
* {@link HostBindingMetadata} factory function.
|
||||||
*/
|
*/
|
||||||
export interface HostBindingFactory {
|
export interface HostBindingMetadataFactory {
|
||||||
(hostPropertyName?: string): any;
|
(hostPropertyName?: string): any;
|
||||||
new (hostPropertyName?: string): any;
|
new (hostPropertyName?: string): any;
|
||||||
}
|
}
|
||||||
|
@ -482,7 +482,7 @@ export interface HostBindingFactory {
|
||||||
/**
|
/**
|
||||||
* {@link HostListenerMetadata} factory function.
|
* {@link HostListenerMetadata} factory function.
|
||||||
*/
|
*/
|
||||||
export interface HostListenerFactory {
|
export interface HostListenerMetadataFactory {
|
||||||
(eventName: string, args?: string[]): any;
|
(eventName: string, args?: string[]): any;
|
||||||
new (eventName: string, args?: string[]): any;
|
new (eventName: string, args?: string[]): any;
|
||||||
}
|
}
|
||||||
|
@ -511,8 +511,8 @@ export interface HostListenerFactory {
|
||||||
*
|
*
|
||||||
* {@example core/ts/metadata/metadata.ts region='component'}
|
* {@example core/ts/metadata/metadata.ts region='component'}
|
||||||
*/
|
*/
|
||||||
export var Component: ComponentFactory =
|
export var Component: ComponentMetadataFactory =
|
||||||
<ComponentFactory>makeDecorator(ComponentMetadata, (fn: any) => fn.View = View);
|
<ComponentMetadataFactory>makeDecorator(ComponentMetadata, (fn: any) => fn.View = View);
|
||||||
|
|
||||||
// TODO(alexeagle): remove the duplication of this doc. It is copied from DirectiveMetadata.
|
// TODO(alexeagle): remove the duplication of this doc. It is copied from DirectiveMetadata.
|
||||||
/**
|
/**
|
||||||
|
@ -893,7 +893,8 @@ export var Component: ComponentFactory =
|
||||||
* the instantiated
|
* the instantiated
|
||||||
* view occurs on the second `<li></li>` which is a sibling to the `<template>` element.
|
* view occurs on the second `<li></li>` which is a sibling to the `<template>` element.
|
||||||
*/
|
*/
|
||||||
export var Directive: DirectiveFactory = <DirectiveFactory>makeDecorator(DirectiveMetadata);
|
export var Directive: DirectiveMetadataFactory =
|
||||||
|
<DirectiveMetadataFactory>makeDecorator(DirectiveMetadata);
|
||||||
|
|
||||||
// TODO(alexeagle): remove the duplication of this doc. It is copied from ViewMetadata.
|
// TODO(alexeagle): remove the duplication of this doc. It is copied from ViewMetadata.
|
||||||
/**
|
/**
|
||||||
|
@ -925,7 +926,8 @@ export var Directive: DirectiveFactory = <DirectiveFactory>makeDecorator(Directi
|
||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
var View: ViewFactory = <ViewFactory>makeDecorator(ViewMetadata, (fn: any) => fn.View = View);
|
var View: ViewMetadataFactory =
|
||||||
|
<ViewMetadataFactory>makeDecorator(ViewMetadata, (fn: any) => fn.View = View);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies that a constant attribute value should be injected.
|
* Specifies that a constant attribute value should be injected.
|
||||||
|
@ -944,7 +946,7 @@ var View: ViewFactory = <ViewFactory>makeDecorator(ViewMetadata, (fn: any) => fn
|
||||||
*
|
*
|
||||||
* {@example core/ts/metadata/metadata.ts region='attributeMetadata'}
|
* {@example core/ts/metadata/metadata.ts region='attributeMetadata'}
|
||||||
*/
|
*/
|
||||||
export var Attribute: AttributeFactory = makeParamDecorator(AttributeMetadata);
|
export var Attribute: AttributeMetadataFactory = makeParamDecorator(AttributeMetadata);
|
||||||
|
|
||||||
// TODO(alexeagle): remove the duplication of this doc. It is copied from QueryMetadata.
|
// TODO(alexeagle): remove the duplication of this doc. It is copied from QueryMetadata.
|
||||||
/**
|
/**
|
||||||
|
@ -1054,7 +1056,7 @@ export var Attribute: AttributeFactory = makeParamDecorator(AttributeMetadata);
|
||||||
* The injected object is an unmodifiable live list.
|
* The injected object is an unmodifiable live list.
|
||||||
* See {@link QueryList} for more details.
|
* See {@link QueryList} for more details.
|
||||||
*/
|
*/
|
||||||
export var Query: QueryFactory = makeParamDecorator(QueryMetadata);
|
export var Query: QueryMetadataFactory = makeParamDecorator(QueryMetadata);
|
||||||
|
|
||||||
// TODO(alexeagle): remove the duplication of this doc. It is copied from ContentChildrenMetadata.
|
// TODO(alexeagle): remove the duplication of this doc. It is copied from ContentChildrenMetadata.
|
||||||
/**
|
/**
|
||||||
|
@ -1077,7 +1079,8 @@ export var Query: QueryFactory = makeParamDecorator(QueryMetadata);
|
||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
export var ContentChildren: ContentChildrenFactory = makePropDecorator(ContentChildrenMetadata);
|
export var ContentChildren: ContentChildrenMetadataFactory =
|
||||||
|
makePropDecorator(ContentChildrenMetadata);
|
||||||
|
|
||||||
// TODO(alexeagle): remove the duplication of this doc. It is copied from ContentChildMetadata.
|
// TODO(alexeagle): remove the duplication of this doc. It is copied from ContentChildMetadata.
|
||||||
/**
|
/**
|
||||||
|
@ -1100,7 +1103,7 @@ export var ContentChildren: ContentChildrenFactory = makePropDecorator(ContentCh
|
||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
export var ContentChild: ContentChildFactory = makePropDecorator(ContentChildMetadata);
|
export var ContentChild: ContentChildMetadataFactory = makePropDecorator(ContentChildMetadata);
|
||||||
|
|
||||||
// TODO(alexeagle): remove the duplication of this doc. It is copied from ViewChildrenMetadata.
|
// TODO(alexeagle): remove the duplication of this doc. It is copied from ViewChildrenMetadata.
|
||||||
/**
|
/**
|
||||||
|
@ -1182,7 +1185,7 @@ export var ContentChild: ContentChildFactory = makePropDecorator(ContentChildMet
|
||||||
*
|
*
|
||||||
* See also: [ViewChildrenMetadata]
|
* See also: [ViewChildrenMetadata]
|
||||||
*/
|
*/
|
||||||
export var ViewChildren: ViewChildrenFactory = makePropDecorator(ViewChildrenMetadata);
|
export var ViewChildren: ViewChildrenMetadataFactory = makePropDecorator(ViewChildrenMetadata);
|
||||||
|
|
||||||
// TODO(alexeagle): remove the duplication of this doc. It is copied from ViewChildMetadata.
|
// TODO(alexeagle): remove the duplication of this doc. It is copied from ViewChildMetadata.
|
||||||
/**
|
/**
|
||||||
|
@ -1255,7 +1258,7 @@ export var ViewChildren: ViewChildrenFactory = makePropDecorator(ViewChildrenMet
|
||||||
* ```
|
* ```
|
||||||
* See also: [ViewChildMetadata]
|
* See also: [ViewChildMetadata]
|
||||||
*/
|
*/
|
||||||
export var ViewChild: ViewChildFactory = makePropDecorator(ViewChildMetadata);
|
export var ViewChild: ViewChildMetadataFactory = makePropDecorator(ViewChildMetadata);
|
||||||
|
|
||||||
// TODO(alexeagle): remove the duplication of this doc. It is copied from ViewQueryMetadata.
|
// TODO(alexeagle): remove the duplication of this doc. It is copied from ViewQueryMetadata.
|
||||||
/**
|
/**
|
||||||
|
@ -1293,7 +1296,7 @@ export var ViewChild: ViewChildFactory = makePropDecorator(ViewChildMetadata);
|
||||||
* The injected object is an iterable and observable live list.
|
* The injected object is an iterable and observable live list.
|
||||||
* See {@link QueryList} for more details.
|
* See {@link QueryList} for more details.
|
||||||
*/
|
*/
|
||||||
export var ViewQuery: QueryFactory = makeParamDecorator(ViewQueryMetadata);
|
export var ViewQuery: QueryMetadataFactory = makeParamDecorator(ViewQueryMetadata);
|
||||||
|
|
||||||
// TODO(alexeagle): remove the duplication of this doc. It is copied from PipeMetadata.
|
// TODO(alexeagle): remove the duplication of this doc. It is copied from PipeMetadata.
|
||||||
/**
|
/**
|
||||||
|
@ -1303,7 +1306,7 @@ export var ViewQuery: QueryFactory = makeParamDecorator(ViewQueryMetadata);
|
||||||
*
|
*
|
||||||
* {@example core/ts/metadata/metadata.ts region='pipe'}
|
* {@example core/ts/metadata/metadata.ts region='pipe'}
|
||||||
*/
|
*/
|
||||||
export var Pipe: PipeFactory = <PipeFactory>makeDecorator(PipeMetadata);
|
export var Pipe: PipeMetadataFactory = <PipeMetadataFactory>makeDecorator(PipeMetadata);
|
||||||
|
|
||||||
// TODO(alexeagle): remove the duplication of this doc. It is copied from InputMetadata.
|
// TODO(alexeagle): remove the duplication of this doc. It is copied from InputMetadata.
|
||||||
/**
|
/**
|
||||||
|
@ -1347,7 +1350,7 @@ export var Pipe: PipeFactory = <PipeFactory>makeDecorator(PipeMetadata);
|
||||||
* bootstrap(App);
|
* bootstrap(App);
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
export var Input: InputFactory = makePropDecorator(InputMetadata);
|
export var Input: InputMetadataFactory = makePropDecorator(InputMetadata);
|
||||||
|
|
||||||
// TODO(alexeagle): remove the duplication of this doc. It is copied from OutputMetadata.
|
// TODO(alexeagle): remove the duplication of this doc. It is copied from OutputMetadata.
|
||||||
/**
|
/**
|
||||||
|
@ -1391,7 +1394,7 @@ export var Input: InputFactory = makePropDecorator(InputMetadata);
|
||||||
* bootstrap(App);
|
* bootstrap(App);
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
export var Output: OutputFactory = makePropDecorator(OutputMetadata);
|
export var Output: OutputMetadataFactory = makePropDecorator(OutputMetadata);
|
||||||
|
|
||||||
// TODO(alexeagle): remove the duplication of this doc. It is copied from HostBindingMetadata.
|
// TODO(alexeagle): remove the duplication of this doc. It is copied from HostBindingMetadata.
|
||||||
/**
|
/**
|
||||||
|
@ -1429,7 +1432,7 @@ export var Output: OutputFactory = makePropDecorator(OutputMetadata);
|
||||||
* bootstrap(App);
|
* bootstrap(App);
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
export var HostBinding: HostBindingFactory = makePropDecorator(HostBindingMetadata);
|
export var HostBinding: HostBindingMetadataFactory = makePropDecorator(HostBindingMetadata);
|
||||||
|
|
||||||
// TODO(alexeagle): remove the duplication of this doc. It is copied from HostListenerMetadata.
|
// TODO(alexeagle): remove the duplication of this doc. It is copied from HostListenerMetadata.
|
||||||
/**
|
/**
|
||||||
|
@ -1466,4 +1469,4 @@ export var HostBinding: HostBindingFactory = makePropDecorator(HostBindingMetada
|
||||||
* bootstrap(App);
|
* bootstrap(App);
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
export var HostListener: HostListenerFactory = makePropDecorator(HostListenerMetadata);
|
export var HostListener: HostListenerMetadataFactory = makePropDecorator(HostListenerMetadata);
|
||||||
|
|
|
@ -16,7 +16,7 @@ export abstract class RenderDebugInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
export abstract class Renderer {
|
export abstract class Renderer {
|
||||||
abstract selectRootElement(selector: string, debugInfo: RenderDebugInfo): any;
|
abstract selectRootElement(selectorOrNode: string | any, debugInfo: RenderDebugInfo): any;
|
||||||
|
|
||||||
abstract createElement(parentElement: any, name: string, debugInfo: RenderDebugInfo): any;
|
abstract createElement(parentElement: any, name: string, debugInfo: RenderDebugInfo): any;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import {ApplicationRef} from 'angular2/src/core/application_ref';
|
import {ApplicationRef} from 'angular2/src/core/application_ref';
|
||||||
import {Injectable} from 'angular2/src/core/di';
|
import {Injectable} from 'angular2/src/core/di';
|
||||||
import {Type} from 'angular2/src/facade/lang';
|
import {Type} from 'angular2/src/facade/lang';
|
||||||
import {ComponentRef} from 'angular2/src/core/linker/dynamic_component_loader';
|
import {ComponentRef} from 'angular2/src/core/linker/component_factory';
|
||||||
import {Provider, Injector} from 'angular2/src/core/di';
|
import {Provider, Injector} from 'angular2/src/core/di';
|
||||||
import {NgZone} from 'angular2/src/core/zone/ng_zone';
|
import {NgZone} from 'angular2/src/core/zone/ng_zone';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {ApplicationRef} from 'angular2/src/core/application_ref';
|
import {ApplicationRef} from 'angular2/src/core/application_ref';
|
||||||
import {ComponentRef, ComponentRef_} from 'angular2/src/core/linker/dynamic_component_loader';
|
import {ComponentRef} from 'angular2/src/core/linker/component_factory';
|
||||||
import {isPresent, NumberWrapper} from 'angular2/src/facade/lang';
|
import {isPresent, NumberWrapper} from 'angular2/src/facade/lang';
|
||||||
import {window} from 'angular2/src/facade/browser';
|
import {window} from 'angular2/src/facade/browser';
|
||||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||||
|
@ -25,9 +25,7 @@ export class AngularTools {
|
||||||
export class AngularProfiler {
|
export class AngularProfiler {
|
||||||
appRef: ApplicationRef;
|
appRef: ApplicationRef;
|
||||||
|
|
||||||
constructor(ref: ComponentRef) {
|
constructor(ref: ComponentRef) { this.appRef = ref.injector.get(ApplicationRef); }
|
||||||
this.appRef = (<ComponentRef_>ref).injector.get(ApplicationRef);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exercises change detection in a loop and then prints the average amount of
|
* Exercises change detection in a loop and then prints the average amount of
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
library angular2.src.tools.tools;
|
library angular2.src.tools.tools;
|
||||||
|
|
||||||
import 'dart:js';
|
import 'dart:js';
|
||||||
import 'package:angular2/src/core/linker/dynamic_component_loader.dart'
|
import 'package:angular2/src/core/linker/component_factory.dart'
|
||||||
show ComponentRef;
|
show ComponentRef;
|
||||||
import 'common_tools.dart' show AngularTools;
|
import 'common_tools.dart' show AngularTools;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {global} from 'angular2/src/facade/lang';
|
import {global} from 'angular2/src/facade/lang';
|
||||||
import {ComponentRef} from 'angular2/src/core/linker/dynamic_component_loader';
|
import {ComponentRef} from 'angular2/src/core/linker/component_factory';
|
||||||
import {AngularTools} from './common_tools';
|
import {AngularTools} from './common_tools';
|
||||||
|
|
||||||
var context = <any>global;
|
var context = <any>global;
|
||||||
|
|
|
@ -8,7 +8,8 @@ import {
|
||||||
CONST_EXPR,
|
CONST_EXPR,
|
||||||
stringify,
|
stringify,
|
||||||
StringWrapper,
|
StringWrapper,
|
||||||
isArray
|
isArray,
|
||||||
|
isString
|
||||||
} from 'angular2/src/facade/lang';
|
} from 'angular2/src/facade/lang';
|
||||||
|
|
||||||
import {BaseException, WrappedException} from 'angular2/src/facade/exceptions';
|
import {BaseException, WrappedException} from 'angular2/src/facade/exceptions';
|
||||||
|
@ -76,10 +77,15 @@ export class DomRenderer implements Renderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
selectRootElement(selector: string, debugInfo: RenderDebugInfo): Element {
|
selectRootElement(selectorOrNode: string | any, debugInfo: RenderDebugInfo): Element {
|
||||||
var el = DOM.querySelector(this._rootRenderer.document, selector);
|
var el;
|
||||||
|
if (isString(selectorOrNode)) {
|
||||||
|
el = DOM.querySelector(this._rootRenderer.document, selectorOrNode);
|
||||||
if (isBlank(el)) {
|
if (isBlank(el)) {
|
||||||
throw new BaseException(`The selector "${selector}" did not match any elements`);
|
throw new BaseException(`The selector "${selectorOrNode}" did not match any elements`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
el = selectorOrNode;
|
||||||
}
|
}
|
||||||
DOM.clearNodes(el);
|
DOM.clearNodes(el);
|
||||||
return el;
|
return el;
|
||||||
|
|
|
@ -118,7 +118,7 @@ export class RouterOutlet implements OnDestroy {
|
||||||
}
|
}
|
||||||
return next.then((_) => {
|
return next.then((_) => {
|
||||||
if (isPresent(this._componentRef)) {
|
if (isPresent(this._componentRef)) {
|
||||||
var onDispose = this._componentRef.then((ref: ComponentRef) => ref.dispose());
|
var onDispose = this._componentRef.then((ref: ComponentRef) => ref.destroy());
|
||||||
this._componentRef = null;
|
this._componentRef = null;
|
||||||
return onDispose;
|
return onDispose;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import {
|
||||||
ViewMetadata,
|
ViewMetadata,
|
||||||
ElementRef,
|
ElementRef,
|
||||||
EmbeddedViewRef,
|
EmbeddedViewRef,
|
||||||
|
ChangeDetectorRef,
|
||||||
provide
|
provide
|
||||||
} from 'angular2/core';
|
} from 'angular2/core';
|
||||||
import {DirectiveResolver, ViewResolver} from 'angular2/compiler';
|
import {DirectiveResolver, ViewResolver} from 'angular2/compiler';
|
||||||
|
@ -14,9 +15,6 @@ import {Type, isPresent, isBlank} from 'angular2/src/facade/lang';
|
||||||
import {PromiseWrapper} from 'angular2/src/facade/async';
|
import {PromiseWrapper} from 'angular2/src/facade/async';
|
||||||
import {ListWrapper, MapWrapper} from 'angular2/src/facade/collection';
|
import {ListWrapper, MapWrapper} from 'angular2/src/facade/collection';
|
||||||
|
|
||||||
import {ViewRef_} from 'angular2/src/core/linker/view_ref';
|
|
||||||
import {AppView} from 'angular2/src/core/linker/view';
|
|
||||||
|
|
||||||
import {el} from './utils';
|
import {el} from './utils';
|
||||||
|
|
||||||
import {DOCUMENT} from 'angular2/src/platform/dom/dom_tokens';
|
import {DOCUMENT} from 'angular2/src/platform/dom/dom_tokens';
|
||||||
|
@ -29,7 +27,7 @@ import {tick} from './fake_async';
|
||||||
/**
|
/**
|
||||||
* Fixture for debugging and testing a component.
|
* Fixture for debugging and testing a component.
|
||||||
*/
|
*/
|
||||||
export abstract class ComponentFixture {
|
export class ComponentFixture {
|
||||||
/**
|
/**
|
||||||
* The DebugElement associated with the root element of this component.
|
* The DebugElement associated with the root element of this component.
|
||||||
*/
|
*/
|
||||||
|
@ -51,46 +49,40 @@ export abstract class ComponentFixture {
|
||||||
elementRef: ElementRef;
|
elementRef: ElementRef;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trigger a change detection cycle for the component.
|
* The ComponentRef for the component
|
||||||
*/
|
*/
|
||||||
abstract detectChanges(checkNoChanges?: boolean): void;
|
componentRef: ComponentRef;
|
||||||
|
|
||||||
abstract checkNoChanges(): void;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trigger component destruction.
|
* The ChangeDetectorRef for the component
|
||||||
*/
|
*/
|
||||||
abstract destroy(): void;
|
changeDetectorRef: ChangeDetectorRef;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export class ComponentFixture_ extends ComponentFixture {
|
|
||||||
/** @internal */
|
|
||||||
_componentRef: ComponentRef;
|
|
||||||
/** @internal */
|
|
||||||
_componentParentView: AppView<any>;
|
|
||||||
|
|
||||||
constructor(componentRef: ComponentRef) {
|
constructor(componentRef: ComponentRef) {
|
||||||
super();
|
this.changeDetectorRef = componentRef.changeDetectorRef;
|
||||||
this._componentParentView = (<ViewRef_>componentRef.hostView).internalView;
|
this.elementRef = componentRef.location;
|
||||||
var hostAppElement = this._componentParentView.getHostViewElement();
|
this.debugElement = <DebugElement>getDebugNode(this.elementRef.nativeElement);
|
||||||
this.elementRef = hostAppElement.ref;
|
this.componentInstance = componentRef.instance;
|
||||||
this.debugElement = <DebugElement>getDebugNode(hostAppElement.nativeElement);
|
this.nativeElement = this.elementRef.nativeElement;
|
||||||
this.componentInstance = hostAppElement.component;
|
this.componentRef = componentRef;
|
||||||
this.nativeElement = hostAppElement.nativeElement;
|
|
||||||
this._componentRef = componentRef;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trigger a change detection cycle for the component.
|
||||||
|
*/
|
||||||
detectChanges(checkNoChanges: boolean = true): void {
|
detectChanges(checkNoChanges: boolean = true): void {
|
||||||
this._componentParentView.detectChanges(false);
|
this.changeDetectorRef.detectChanges();
|
||||||
if (checkNoChanges) {
|
if (checkNoChanges) {
|
||||||
this.checkNoChanges();
|
this.checkNoChanges();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
checkNoChanges(): void { this._componentParentView.detectChanges(true); }
|
checkNoChanges(): void { this.changeDetectorRef.checkNoChanges(); }
|
||||||
|
|
||||||
destroy(): void { this._componentRef.dispose(); }
|
/**
|
||||||
|
* Trigger component destruction.
|
||||||
|
*/
|
||||||
|
destroy(): void { this.componentRef.destroy(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
var _nextRootElementId = 0;
|
var _nextRootElementId = 0;
|
||||||
|
@ -261,11 +253,10 @@ export class TestComponentBuilder {
|
||||||
}
|
}
|
||||||
DOM.appendChild(doc.body, rootEl);
|
DOM.appendChild(doc.body, rootEl);
|
||||||
|
|
||||||
|
|
||||||
var promise: Promise<ComponentRef> =
|
var promise: Promise<ComponentRef> =
|
||||||
this._injector.get(DynamicComponentLoader)
|
this._injector.get(DynamicComponentLoader)
|
||||||
.loadAsRoot(rootComponentType, `#${rootElId}`, this._injector);
|
.loadAsRoot(rootComponentType, `#${rootElId}`, this._injector);
|
||||||
return promise.then((componentRef) => { return new ComponentFixture_(componentRef); });
|
return promise.then((componentRef) => { return new ComponentFixture(componentRef); });
|
||||||
}
|
}
|
||||||
|
|
||||||
createFakeAsync(rootComponentType: Type): ComponentFixture {
|
createFakeAsync(rootComponentType: Type): ComponentFixture {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
export const NG2_APP_VIEW_MANAGER = 'ng2.AppViewManager';
|
export const NG2_APP_VIEW_MANAGER = 'ng2.AppViewManager';
|
||||||
export const NG2_COMPILER = 'ng2.Compiler';
|
export const NG2_COMPILER = 'ng2.Compiler';
|
||||||
export const NG2_INJECTOR = 'ng2.Injector';
|
export const NG2_INJECTOR = 'ng2.Injector';
|
||||||
export const NG2_HOST_VIEW_FACTORY_REF_MAP = 'ng2.HostViewFactoryRefMap';
|
export const NG2_COMPONENT_FACTORY_REF_MAP = 'ng2.ComponentFactoryRefMap';
|
||||||
export const NG2_ZONE = 'ng2.NgZone';
|
export const NG2_ZONE = 'ng2.NgZone';
|
||||||
|
|
||||||
export const NG1_CONTROLLER = '$controller';
|
export const NG1_CONTROLLER = '$controller';
|
||||||
|
|
|
@ -2,10 +2,10 @@ import {
|
||||||
provide,
|
provide,
|
||||||
AppViewManager,
|
AppViewManager,
|
||||||
ChangeDetectorRef,
|
ChangeDetectorRef,
|
||||||
HostViewRef,
|
|
||||||
Injector,
|
Injector,
|
||||||
OnChanges,
|
OnChanges,
|
||||||
HostViewFactoryRef,
|
ComponentFactory,
|
||||||
|
ComponentRef,
|
||||||
SimpleChange
|
SimpleChange
|
||||||
} from 'angular2/core';
|
} from 'angular2/core';
|
||||||
import {NG1_SCOPE} from './constants';
|
import {NG1_SCOPE} from './constants';
|
||||||
|
@ -21,7 +21,7 @@ export class DowngradeNg2ComponentAdapter {
|
||||||
component: any = null;
|
component: any = null;
|
||||||
inputChangeCount: number = 0;
|
inputChangeCount: number = 0;
|
||||||
inputChanges: {[key: string]: SimpleChange} = null;
|
inputChanges: {[key: string]: SimpleChange} = null;
|
||||||
hostViewRef: HostViewRef = null;
|
componentRef: ComponentRef = null;
|
||||||
changeDetector: ChangeDetectorRef = null;
|
changeDetector: ChangeDetectorRef = null;
|
||||||
componentScope: angular.IScope;
|
componentScope: angular.IScope;
|
||||||
childNodes: Node[];
|
childNodes: Node[];
|
||||||
|
@ -31,7 +31,7 @@ export class DowngradeNg2ComponentAdapter {
|
||||||
private element: angular.IAugmentedJQuery, private attrs: angular.IAttributes,
|
private element: angular.IAugmentedJQuery, private attrs: angular.IAttributes,
|
||||||
private scope: angular.IScope, private parentInjector: Injector,
|
private scope: angular.IScope, private parentInjector: Injector,
|
||||||
private parse: angular.IParseService, private viewManager: AppViewManager,
|
private parse: angular.IParseService, private viewManager: AppViewManager,
|
||||||
private hostViewFactory: HostViewFactoryRef) {
|
private componentFactory: ComponentFactory) {
|
||||||
(<any>this.element[0]).id = id;
|
(<any>this.element[0]).id = id;
|
||||||
this.componentScope = scope.$new();
|
this.componentScope = scope.$new();
|
||||||
this.childNodes = <Node[]><any>element.contents();
|
this.childNodes = <Node[]><any>element.contents();
|
||||||
|
@ -42,11 +42,10 @@ export class DowngradeNg2ComponentAdapter {
|
||||||
[provide(NG1_SCOPE, {useValue: this.componentScope})]);
|
[provide(NG1_SCOPE, {useValue: this.componentScope})]);
|
||||||
this.contentInsertionPoint = document.createComment('ng1 insertion point');
|
this.contentInsertionPoint = document.createComment('ng1 insertion point');
|
||||||
|
|
||||||
this.hostViewRef = this.viewManager.createRootHostView(
|
this.componentRef =
|
||||||
this.hostViewFactory, '#' + this.id, childInjector, [[this.contentInsertionPoint]]);
|
this.componentFactory.create(childInjector, [[this.contentInsertionPoint]], '#' + this.id);
|
||||||
var hostElement = this.viewManager.getHostElement(this.hostViewRef);
|
this.changeDetector = this.componentRef.changeDetectorRef;
|
||||||
this.changeDetector = this.hostViewRef.changeDetectorRef;
|
this.component = this.componentRef.instance;
|
||||||
this.component = this.viewManager.getComponent(hostElement);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setupInputs(): void {
|
setupInputs(): void {
|
||||||
|
@ -162,7 +161,7 @@ export class DowngradeNg2ComponentAdapter {
|
||||||
registerCleanup() {
|
registerCleanup() {
|
||||||
this.element.bind('$destroy', () => {
|
this.element.bind('$destroy', () => {
|
||||||
this.componentScope.$destroy();
|
this.componentScope.$destroy();
|
||||||
this.viewManager.destroyRootHostView(this.hostViewRef);
|
this.componentRef.destroy();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,11 +3,11 @@ import {
|
||||||
platform,
|
platform,
|
||||||
ApplicationRef,
|
ApplicationRef,
|
||||||
AppViewManager,
|
AppViewManager,
|
||||||
Compiler,
|
ComponentResolver,
|
||||||
Injector,
|
Injector,
|
||||||
NgZone,
|
NgZone,
|
||||||
PlatformRef,
|
PlatformRef,
|
||||||
HostViewFactoryRef,
|
ComponentFactory,
|
||||||
Provider,
|
Provider,
|
||||||
Type,
|
Type,
|
||||||
Testability,
|
Testability,
|
||||||
|
@ -29,7 +29,7 @@ import {
|
||||||
NG2_APP_VIEW_MANAGER,
|
NG2_APP_VIEW_MANAGER,
|
||||||
NG2_COMPILER,
|
NG2_COMPILER,
|
||||||
NG2_INJECTOR,
|
NG2_INJECTOR,
|
||||||
NG2_HOST_VIEW_FACTORY_REF_MAP,
|
NG2_COMPONENT_FACTORY_REF_MAP,
|
||||||
NG2_ZONE,
|
NG2_ZONE,
|
||||||
REQUIRE_INJECTOR
|
REQUIRE_INJECTOR
|
||||||
} from './constants';
|
} from './constants';
|
||||||
|
@ -305,19 +305,19 @@ export class UpgradeAdapter {
|
||||||
]);
|
]);
|
||||||
var injector: Injector = applicationRef.injector;
|
var injector: Injector = applicationRef.injector;
|
||||||
var ngZone: NgZone = injector.get(NgZone);
|
var ngZone: NgZone = injector.get(NgZone);
|
||||||
var compiler: Compiler = injector.get(Compiler);
|
var compiler: ComponentResolver = injector.get(ComponentResolver);
|
||||||
var delayApplyExps: Function[] = [];
|
var delayApplyExps: Function[] = [];
|
||||||
var original$applyFn: Function;
|
var original$applyFn: Function;
|
||||||
var rootScopePrototype: any;
|
var rootScopePrototype: any;
|
||||||
var rootScope: angular.IRootScopeService;
|
var rootScope: angular.IRootScopeService;
|
||||||
var hostViewFactoryRefMap: HostViewFactoryRefMap = {};
|
var componentFactoryRefMap: ComponentFactoryRefMap = {};
|
||||||
var ng1Module = angular.module(this.idPrefix, modules);
|
var ng1Module = angular.module(this.idPrefix, modules);
|
||||||
var ng1BootstrapPromise: Promise<any> = null;
|
var ng1BootstrapPromise: Promise<any> = null;
|
||||||
var ng1compilePromise: Promise<any> = null;
|
var ng1compilePromise: Promise<any> = null;
|
||||||
ng1Module.value(NG2_INJECTOR, injector)
|
ng1Module.value(NG2_INJECTOR, injector)
|
||||||
.value(NG2_ZONE, ngZone)
|
.value(NG2_ZONE, ngZone)
|
||||||
.value(NG2_COMPILER, compiler)
|
.value(NG2_COMPILER, compiler)
|
||||||
.value(NG2_HOST_VIEW_FACTORY_REF_MAP, hostViewFactoryRefMap)
|
.value(NG2_COMPONENT_FACTORY_REF_MAP, componentFactoryRefMap)
|
||||||
.value(NG2_APP_VIEW_MANAGER, injector.get(AppViewManager))
|
.value(NG2_APP_VIEW_MANAGER, injector.get(AppViewManager))
|
||||||
.config([
|
.config([
|
||||||
'$provide',
|
'$provide',
|
||||||
|
@ -393,7 +393,7 @@ export class UpgradeAdapter {
|
||||||
});
|
});
|
||||||
|
|
||||||
Promise.all([
|
Promise.all([
|
||||||
this.compileNg2Components(compiler, hostViewFactoryRefMap),
|
this.compileNg2Components(compiler, componentFactoryRefMap),
|
||||||
ng1BootstrapPromise,
|
ng1BootstrapPromise,
|
||||||
ng1compilePromise
|
ng1compilePromise
|
||||||
])
|
])
|
||||||
|
@ -519,35 +519,36 @@ export class UpgradeAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @internal */
|
/* @internal */
|
||||||
private compileNg2Components(compiler: Compiler, hostViewFactoryRefMap: HostViewFactoryRefMap):
|
private compileNg2Components(compiler: ComponentResolver,
|
||||||
Promise<HostViewFactoryRefMap> {
|
componentFactoryRefMap: ComponentFactoryRefMap):
|
||||||
var promises: Array<Promise<HostViewFactoryRef>> = [];
|
Promise<ComponentFactoryRefMap> {
|
||||||
|
var promises: Array<Promise<ComponentFactory>> = [];
|
||||||
var types = this.upgradedComponents;
|
var types = this.upgradedComponents;
|
||||||
for (var i = 0; i < types.length; i++) {
|
for (var i = 0; i < types.length; i++) {
|
||||||
promises.push(compiler.compileInHost(types[i]));
|
promises.push(compiler.resolveComponent(types[i]));
|
||||||
}
|
}
|
||||||
return Promise.all(promises).then((hostViewFactories: Array<HostViewFactoryRef>) => {
|
return Promise.all(promises).then((componentFactories: Array<ComponentFactory>) => {
|
||||||
var types = this.upgradedComponents;
|
var types = this.upgradedComponents;
|
||||||
for (var i = 0; i < hostViewFactories.length; i++) {
|
for (var i = 0; i < componentFactories.length; i++) {
|
||||||
hostViewFactoryRefMap[getComponentInfo(types[i]).selector] = hostViewFactories[i];
|
componentFactoryRefMap[getComponentInfo(types[i]).selector] = componentFactories[i];
|
||||||
}
|
}
|
||||||
return hostViewFactoryRefMap;
|
return componentFactoryRefMap;
|
||||||
}, onError);
|
}, onError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface HostViewFactoryRefMap {
|
interface ComponentFactoryRefMap {
|
||||||
[selector: string]: HostViewFactoryRef;
|
[selector: string]: ComponentFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
function ng1ComponentDirective(info: ComponentInfo, idPrefix: string): Function {
|
function ng1ComponentDirective(info: ComponentInfo, idPrefix: string): Function {
|
||||||
(<any>directiveFactory).$inject =
|
(<any>directiveFactory).$inject =
|
||||||
[NG2_HOST_VIEW_FACTORY_REF_MAP, NG2_APP_VIEW_MANAGER, NG1_PARSE];
|
[NG2_COMPONENT_FACTORY_REF_MAP, NG2_APP_VIEW_MANAGER, NG1_PARSE];
|
||||||
function directiveFactory(hostViewFactoryRefMap: HostViewFactoryRefMap,
|
function directiveFactory(componentFactoryRefMap: ComponentFactoryRefMap,
|
||||||
viewManager: AppViewManager,
|
viewManager: AppViewManager,
|
||||||
parse: angular.IParseService): angular.IDirective {
|
parse: angular.IParseService): angular.IDirective {
|
||||||
var hostViewFactory: HostViewFactoryRef = hostViewFactoryRefMap[info.selector];
|
var componentFactory: ComponentFactory = componentFactoryRefMap[info.selector];
|
||||||
if (!hostViewFactory) throw new Error('Expecting HostViewFactoryRef for: ' + info.selector);
|
if (!componentFactory) throw new Error('Expecting ComponentFactory for: ' + info.selector);
|
||||||
var idCount = 0;
|
var idCount = 0;
|
||||||
return {
|
return {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
|
@ -558,7 +559,7 @@ function ng1ComponentDirective(info: ComponentInfo, idPrefix: string): Function
|
||||||
var domElement = <any>element[0];
|
var domElement = <any>element[0];
|
||||||
var facade = new DowngradeNg2ComponentAdapter(idPrefix + (idCount++), info, element,
|
var facade = new DowngradeNg2ComponentAdapter(idPrefix + (idCount++), info, element,
|
||||||
attrs, scope, <Injector>parentInjector,
|
attrs, scope, <Injector>parentInjector,
|
||||||
parse, viewManager, hostViewFactory);
|
parse, viewManager, componentFactory);
|
||||||
facade.setupInputs();
|
facade.setupInputs();
|
||||||
facade.bootstrapNg2();
|
facade.bootstrapNg2();
|
||||||
facade.projectContent();
|
facade.projectContent();
|
||||||
|
|
|
@ -95,10 +95,10 @@ export class WebWorkerRenderer implements Renderer, RenderStoreObject {
|
||||||
this._rootRenderer.runOnService(fnName, fnArgsWithRenderer);
|
this._rootRenderer.runOnService(fnName, fnArgsWithRenderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
selectRootElement(selector: string, debugInfo: RenderDebugInfo): any {
|
selectRootElement(selectorOrNode: string, debugInfo: RenderDebugInfo): any {
|
||||||
var node = this._rootRenderer.allocateNode();
|
var node = this._rootRenderer.allocateNode();
|
||||||
this._runOnService('selectRootElement',
|
this._runOnService('selectRootElement',
|
||||||
[new FnArg(selector, null), new FnArg(node, RenderStoreObject)]);
|
[new FnArg(selectorOrNode, null), new FnArg(node, RenderStoreObject)]);
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,9 @@ import {TypeScriptEmitter} from 'angular2/src/compiler/output/ts_emitter';
|
||||||
import {DartEmitter} from 'angular2/src/compiler/output/dart_emitter';
|
import {DartEmitter} from 'angular2/src/compiler/output/dart_emitter';
|
||||||
import * as o from 'angular2/src/compiler/output/output_ast';
|
import * as o from 'angular2/src/compiler/output/output_ast';
|
||||||
import {compileComp, compAMetadata} from './offline_compiler_util';
|
import {compileComp, compAMetadata} from './offline_compiler_util';
|
||||||
import {HostViewFactory} from 'angular2/src/core/linker/view';
|
import {ComponentFactory} from 'angular2/src/core/linker/component_factory';
|
||||||
|
|
||||||
export const hostViewFactory_CompA: HostViewFactory = null;
|
export const CompANgFactory: ComponentFactory = null;
|
||||||
|
|
||||||
// Generator
|
// Generator
|
||||||
export function main(args: string[]) {
|
export function main(args: string[]) {
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
import {print} from 'angular2/src/facade/lang';
|
import {print} from 'angular2/src/facade/lang';
|
||||||
import {JavaScriptEmitter} from 'angular2/src/compiler/output/js_emitter';
|
import {JavaScriptEmitter} from 'angular2/src/compiler/output/js_emitter';
|
||||||
import {compileComp, compAMetadata} from './offline_compiler_util';
|
import {compileComp, compAMetadata} from './offline_compiler_util';
|
||||||
import {HostViewFactory} from 'angular2/src/core/linker/view';
|
import {ComponentFactory} from 'angular2/src/core/linker/component_factory';
|
||||||
|
|
||||||
export const hostViewFactory_CompA: HostViewFactory = null;
|
export const CompANgFactory: ComponentFactory = null;
|
||||||
|
|
||||||
// Generator
|
// Generator
|
||||||
export function main(args: string[]) {
|
export function main(args: string[]) {
|
||||||
|
|
|
@ -18,65 +18,48 @@ import {IS_DART} from 'angular2/src/facade/lang';
|
||||||
import {Injector} from 'angular2/core';
|
import {Injector} from 'angular2/core';
|
||||||
import {DebugNode, DebugElement, getDebugNode} from 'angular2/src/core/debug/debug_node';
|
import {DebugNode, DebugElement, getDebugNode} from 'angular2/src/core/debug/debug_node';
|
||||||
|
|
||||||
import {HostViewFactoryRef_} from 'angular2/src/core/linker/view_ref';
|
import {ComponentFactory} from 'angular2/src/core/linker/component_factory';
|
||||||
import {HostViewFactory} from 'angular2/src/core/linker/view';
|
|
||||||
import * as typed from './offline_compiler_codegen_typed';
|
import * as typed from './offline_compiler_codegen_typed';
|
||||||
import * as untyped from './offline_compiler_codegen_untyped';
|
import * as untyped from './offline_compiler_codegen_untyped';
|
||||||
|
|
||||||
import {AppViewManager} from 'angular2/src/core/linker/view_manager';
|
|
||||||
import {DOCUMENT} from 'angular2/src/platform/dom/dom_tokens';
|
|
||||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||||
import {SharedStylesHost} from "angular2/src/platform/dom/shared_styles_host";
|
import {SharedStylesHost} from "angular2/src/platform/dom/shared_styles_host";
|
||||||
|
|
||||||
import {CompA} from './offline_compiler_util';
|
import {CompA} from './offline_compiler_util';
|
||||||
|
|
||||||
var _nextRootElementId = 0;
|
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
var outputDefs = [];
|
var outputDefs = [];
|
||||||
var typedHostViewFactory = typed.hostViewFactory_CompA;
|
var typedComponentFactory = typed.CompANgFactory;
|
||||||
var untypedHostViewFactory = untyped.hostViewFactory_CompA;
|
var untypedComponentFactory = untyped.CompANgFactory;
|
||||||
|
|
||||||
if (IS_DART || !DOM.supportsDOMEvents()) {
|
if (IS_DART || !DOM.supportsDOMEvents()) {
|
||||||
// Our generator only works on node.js and Dart...
|
// Our generator only works on node.js and Dart...
|
||||||
outputDefs.push({'compAHostViewFactory': typedHostViewFactory, 'name': 'typed'});
|
outputDefs.push({'compAHostComponentFactory': typedComponentFactory, 'name': 'typed'});
|
||||||
}
|
}
|
||||||
if (!IS_DART) {
|
if (!IS_DART) {
|
||||||
// Our generator only works on node.js and Dart...
|
// Our generator only works on node.js and Dart...
|
||||||
if (!DOM.supportsDOMEvents()) {
|
if (!DOM.supportsDOMEvents()) {
|
||||||
outputDefs.push({'compAHostViewFactory': untypedHostViewFactory, 'name': 'untyped'});
|
outputDefs.push({'compAHostComponentFactory': untypedComponentFactory, 'name': 'untyped'});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
describe('OfflineCompiler', () => {
|
describe('OfflineCompiler', () => {
|
||||||
var viewManager: AppViewManager;
|
|
||||||
var injector: Injector;
|
var injector: Injector;
|
||||||
var sharedStylesHost: SharedStylesHost;
|
var sharedStylesHost: SharedStylesHost;
|
||||||
var rootEl;
|
|
||||||
|
|
||||||
beforeEach(inject([AppViewManager, Injector, SharedStylesHost],
|
beforeEach(inject([Injector, SharedStylesHost], (_injector, _sharedStylesHost) => {
|
||||||
(_viewManager, _injector, _sharedStylesHost) => {
|
|
||||||
viewManager = _viewManager;
|
|
||||||
injector = _injector;
|
injector = _injector;
|
||||||
sharedStylesHost = _sharedStylesHost;
|
sharedStylesHost = _sharedStylesHost;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
function createHostComp(hvf: HostViewFactory): DebugElement {
|
function createHostComp(cf: ComponentFactory): DebugElement {
|
||||||
var doc = injector.get(DOCUMENT);
|
var compRef = cf.create(injector);
|
||||||
var oldRoots = DOM.querySelectorAll(doc, hvf.selector);
|
return <DebugElement>getDebugNode(compRef.location.nativeElement);
|
||||||
for (var i = 0; i < oldRoots.length; i++) {
|
|
||||||
DOM.remove(oldRoots[i]);
|
|
||||||
}
|
|
||||||
rootEl = el(`<${hvf.selector}></${hvf.selector}>`);
|
|
||||||
DOM.appendChild(doc.body, rootEl);
|
|
||||||
|
|
||||||
viewManager.createRootHostView(new HostViewFactoryRef_(hvf), hvf.selector, injector, []);
|
|
||||||
return <DebugElement>getDebugNode(rootEl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
outputDefs.forEach((outputDef) => {
|
outputDefs.forEach((outputDef) => {
|
||||||
describe(`${outputDef['name']}`, () => {
|
describe(`${outputDef['name']}`, () => {
|
||||||
it('should compile components', () => {
|
it('should compile components', () => {
|
||||||
var hostEl = createHostComp(outputDef['compAHostViewFactory']);
|
var hostEl = createHostComp(outputDef['compAHostComponentFactory']);
|
||||||
expect(hostEl.componentInstance).toBeAnInstanceOf(CompA);
|
expect(hostEl.componentInstance).toBeAnInstanceOf(CompA);
|
||||||
var styles = sharedStylesHost.getAllStyles();
|
var styles = sharedStylesHost.getAllStyles();
|
||||||
expect(styles[0]).toContain('.redStyle[_ngcontent');
|
expect(styles[0]).toContain('.redStyle[_ngcontent');
|
||||||
|
|
|
@ -1,51 +0,0 @@
|
||||||
import {
|
|
||||||
ddescribe,
|
|
||||||
describe,
|
|
||||||
xdescribe,
|
|
||||||
it,
|
|
||||||
iit,
|
|
||||||
xit,
|
|
||||||
expect,
|
|
||||||
beforeEach,
|
|
||||||
afterEach,
|
|
||||||
AsyncTestCompleter,
|
|
||||||
inject,
|
|
||||||
beforeEachProviders
|
|
||||||
} from 'angular2/testing_internal';
|
|
||||||
|
|
||||||
import {provide} from 'angular2/core';
|
|
||||||
import {Compiler} from 'angular2/src/core/linker/compiler';
|
|
||||||
import {reflector, ReflectionInfo} from 'angular2/src/core/reflection/reflection';
|
|
||||||
import {Compiler_} from "angular2/src/core/linker/compiler";
|
|
||||||
import {HostViewFactory} from 'angular2/src/core/linker/view';
|
|
||||||
import {HostViewFactoryRef_} from 'angular2/src/core/linker/view_ref';
|
|
||||||
|
|
||||||
export function main() {
|
|
||||||
describe('Compiler', () => {
|
|
||||||
var someHostViewFactory;
|
|
||||||
|
|
||||||
beforeEachProviders(() => [provide(Compiler, {useClass: Compiler_})]);
|
|
||||||
|
|
||||||
beforeEach(inject([Compiler], (_compiler) => {
|
|
||||||
someHostViewFactory = new HostViewFactory(null, null);
|
|
||||||
reflector.registerType(SomeComponent, new ReflectionInfo([someHostViewFactory]));
|
|
||||||
}));
|
|
||||||
|
|
||||||
it('should read the template from an annotation',
|
|
||||||
inject([AsyncTestCompleter, Compiler], (async, compiler: Compiler) => {
|
|
||||||
compiler.compileInHost(SomeComponent)
|
|
||||||
.then((hostViewFactoryRef: HostViewFactoryRef_) => {
|
|
||||||
expect(hostViewFactoryRef.internalHostViewFactory).toBe(someHostViewFactory);
|
|
||||||
async.done();
|
|
||||||
return null;
|
|
||||||
});
|
|
||||||
}));
|
|
||||||
|
|
||||||
it('should clear the cache', inject([Compiler], (compiler) => {
|
|
||||||
// Nothing to assert for now...
|
|
||||||
compiler.clearCache();
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
class SomeComponent {}
|
|
|
@ -24,7 +24,6 @@ import {DynamicComponentLoader} from 'angular2/src/core/linker/dynamic_component
|
||||||
import {ElementRef, ElementRef_} from 'angular2/src/core/linker/element_ref';
|
import {ElementRef, ElementRef_} from 'angular2/src/core/linker/element_ref';
|
||||||
import {DOCUMENT} from 'angular2/src/platform/dom/dom_tokens';
|
import {DOCUMENT} from 'angular2/src/platform/dom/dom_tokens';
|
||||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||||
import {ComponentFixture_} from "angular2/src/testing/test_component_builder";
|
|
||||||
import {BaseException} from 'angular2/src/facade/exceptions';
|
import {BaseException} from 'angular2/src/facade/exceptions';
|
||||||
import {PromiseWrapper} from 'angular2/src/facade/promise';
|
import {PromiseWrapper} from 'angular2/src/facade/promise';
|
||||||
|
|
||||||
|
@ -61,14 +60,14 @@ export function main() {
|
||||||
|
|
||||||
loader.loadIntoLocation(DynamicallyLoaded, tc.elementRef, 'loc')
|
loader.loadIntoLocation(DynamicallyLoaded, tc.elementRef, 'loc')
|
||||||
.then(ref => {
|
.then(ref => {
|
||||||
ref.dispose();
|
ref.destroy();
|
||||||
expect(tc.debugElement.nativeElement).toHaveText("Location;");
|
expect(tc.debugElement.nativeElement).toHaveText("Location;");
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should allow to dispose even if the location has been removed',
|
it('should allow to destroy even if the location has been removed',
|
||||||
inject([DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter],
|
inject([DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter],
|
||||||
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async) => {
|
(loader: DynamicComponentLoader, tcb: TestComponentBuilder, async) => {
|
||||||
tcb.overrideView(MyComp, new ViewMetadata({
|
tcb.overrideView(MyComp, new ViewMetadata({
|
||||||
|
@ -95,7 +94,7 @@ export function main() {
|
||||||
tc.detectChanges();
|
tc.detectChanges();
|
||||||
expect(tc.debugElement.nativeElement).toHaveText("");
|
expect(tc.debugElement.nativeElement).toHaveText("");
|
||||||
|
|
||||||
ref.dispose();
|
ref.destroy();
|
||||||
expect(tc.debugElement.nativeElement).toHaveText("");
|
expect(tc.debugElement.nativeElement).toHaveText("");
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
|
@ -236,7 +235,7 @@ export function main() {
|
||||||
expect(firstSibling).toHaveText("DynamicallyLoaded;");
|
expect(firstSibling).toHaveText("DynamicallyLoaded;");
|
||||||
expect(secondSibling).toHaveText("DynamicallyLoaded2;");
|
expect(secondSibling).toHaveText("DynamicallyLoaded2;");
|
||||||
|
|
||||||
ref2.dispose();
|
ref2.destroy();
|
||||||
|
|
||||||
firstSibling = DOM.nextSibling(tc.debugElement.nativeElement);
|
firstSibling = DOM.nextSibling(tc.debugElement.nativeElement);
|
||||||
secondSibling = DOM.nextSibling(firstSibling);
|
secondSibling = DOM.nextSibling(firstSibling);
|
||||||
|
@ -302,7 +301,7 @@ export function main() {
|
||||||
DOM.appendChild(doc.body, rootEl);
|
DOM.appendChild(doc.body, rootEl);
|
||||||
loader.loadAsRoot(ChildComp, null, injector)
|
loader.loadAsRoot(ChildComp, null, injector)
|
||||||
.then((componentRef) => {
|
.then((componentRef) => {
|
||||||
var el = new ComponentFixture_(componentRef);
|
var el = new ComponentFixture(componentRef);
|
||||||
|
|
||||||
expect(rootEl.parentNode).toBe(doc.body);
|
expect(rootEl.parentNode).toBe(doc.body);
|
||||||
|
|
||||||
|
@ -316,7 +315,7 @@ export function main() {
|
||||||
|
|
||||||
expect(rootEl).toHaveText('new');
|
expect(rootEl).toHaveText('new');
|
||||||
|
|
||||||
componentRef.dispose();
|
componentRef.destroy();
|
||||||
|
|
||||||
expect(rootEl.parentNode).toBeFalsy();
|
expect(rootEl.parentNode).toBeFalsy();
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ import {QueryList} from 'angular2/src/core/linker/query_list';
|
||||||
import {ViewContainerRef} from 'angular2/src/core/linker/view_container_ref';
|
import {ViewContainerRef} from 'angular2/src/core/linker/view_container_ref';
|
||||||
import {EmbeddedViewRef} from 'angular2/src/core/linker/view_ref';
|
import {EmbeddedViewRef} from 'angular2/src/core/linker/view_ref';
|
||||||
|
|
||||||
import {Compiler} from 'angular2/src/core/linker/compiler';
|
import {ComponentResolver} from 'angular2/src/core/linker/component_resolver';
|
||||||
import {ElementRef} from 'angular2/src/core/linker/element_ref';
|
import {ElementRef} from 'angular2/src/core/linker/element_ref';
|
||||||
import {TemplateRef} from 'angular2/src/core/linker/template_ref';
|
import {TemplateRef} from 'angular2/src/core/linker/template_ref';
|
||||||
|
|
||||||
|
@ -1167,7 +1167,7 @@ function declareTests(isJit: boolean) {
|
||||||
|
|
||||||
describe('dynamic ViewContainers', () => {
|
describe('dynamic ViewContainers', () => {
|
||||||
it('should allow to create a ViewContainerRef at any bound location',
|
it('should allow to create a ViewContainerRef at any bound location',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter, Compiler],
|
inject([TestComponentBuilder, AsyncTestCompleter, ComponentResolver],
|
||||||
(tcb: TestComponentBuilder, async, compiler) => {
|
(tcb: TestComponentBuilder, async, compiler) => {
|
||||||
tcb.overrideView(MyComp, new ViewMetadata({
|
tcb.overrideView(MyComp, new ViewMetadata({
|
||||||
template: '<div><dynamic-vp #dynamic></dynamic-vp></div>',
|
template: '<div><dynamic-vp #dynamic></dynamic-vp></div>',
|
||||||
|
@ -1946,13 +1946,13 @@ class SimpleImperativeViewComponent {
|
||||||
@Injectable()
|
@Injectable()
|
||||||
class DynamicViewport {
|
class DynamicViewport {
|
||||||
done: Promise<any>;
|
done: Promise<any>;
|
||||||
constructor(vc: ViewContainerRef, compiler: Compiler) {
|
constructor(vc: ViewContainerRef, compiler: ComponentResolver) {
|
||||||
var myService = new MyService();
|
var myService = new MyService();
|
||||||
myService.greeting = 'dynamic greet';
|
myService.greeting = 'dynamic greet';
|
||||||
|
|
||||||
var bindings = Injector.resolve([provide(MyService, {useValue: myService})]);
|
var bindings = Injector.resolve([provide(MyService, {useValue: myService})]);
|
||||||
this.done = compiler.compileInHost(ChildCompUsingService)
|
this.done = compiler.resolveComponent(ChildCompUsingService)
|
||||||
.then((hostPv) => {vc.createHostView(hostPv, 0, bindings)});
|
.then((compFactory) => {vc.createComponent(compFactory, 0, bindings)});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
import {
|
||||||
|
ddescribe,
|
||||||
|
describe,
|
||||||
|
xdescribe,
|
||||||
|
it,
|
||||||
|
iit,
|
||||||
|
xit,
|
||||||
|
expect,
|
||||||
|
beforeEach,
|
||||||
|
afterEach,
|
||||||
|
AsyncTestCompleter,
|
||||||
|
inject,
|
||||||
|
beforeEachProviders
|
||||||
|
} from 'angular2/testing_internal';
|
||||||
|
|
||||||
|
import {provide} from 'angular2/core';
|
||||||
|
import {
|
||||||
|
ComponentResolver,
|
||||||
|
ReflectorComponentResolver
|
||||||
|
} from 'angular2/src/core/linker/component_resolver';
|
||||||
|
import {reflector, ReflectionInfo} from 'angular2/src/core/reflection/reflection';
|
||||||
|
import {ComponentFactory} from 'angular2/src/core/linker/component_factory';
|
||||||
|
|
||||||
|
export function main() {
|
||||||
|
describe('Compiler', () => {
|
||||||
|
var someCompFactory;
|
||||||
|
|
||||||
|
beforeEachProviders(() => [provide(ComponentResolver, {useClass: ReflectorComponentResolver})]);
|
||||||
|
|
||||||
|
beforeEach(inject([ComponentResolver], (_compiler) => {
|
||||||
|
someCompFactory = new ComponentFactory(null, null, null);
|
||||||
|
reflector.registerType(SomeComponent, new ReflectionInfo([someCompFactory]));
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('should read the template from an annotation',
|
||||||
|
inject([AsyncTestCompleter, ComponentResolver], (async, compiler: ComponentResolver) => {
|
||||||
|
compiler.resolveComponent(SomeComponent)
|
||||||
|
.then((compFactory: ComponentFactory) => {
|
||||||
|
expect(compFactory).toBe(someCompFactory);
|
||||||
|
async.done();
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
class SomeComponent {}
|
|
@ -24,7 +24,7 @@ import {provide, Inject, Injector, PLATFORM_INITIALIZER, APP_INITIALIZER} from '
|
||||||
import {disposePlatform} from 'angular2/src/core/application_ref';
|
import {disposePlatform} from 'angular2/src/core/application_ref';
|
||||||
import {ExceptionHandler, BaseException} from 'angular2/src/facade/exceptions';
|
import {ExceptionHandler, BaseException} from 'angular2/src/facade/exceptions';
|
||||||
import {Testability, TestabilityRegistry} from 'angular2/src/core/testability/testability';
|
import {Testability, TestabilityRegistry} from 'angular2/src/core/testability/testability';
|
||||||
import {ComponentRef_, ComponentRef} from "angular2/src/core/linker/dynamic_component_loader";
|
import {ComponentRef} from "angular2/src/core/linker/component_factory";
|
||||||
|
|
||||||
@Component({selector: 'hello-app', template: '{{greeting}} world!'})
|
@Component({selector: 'hello-app', template: '{{greeting}} world!'})
|
||||||
class HelloRootCmp {
|
class HelloRootCmp {
|
||||||
|
@ -194,7 +194,7 @@ export function main() {
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
bootstrap(HelloOnDestroyTickCmp, testProviders)
|
bootstrap(HelloOnDestroyTickCmp, testProviders)
|
||||||
.then((ref) => {
|
.then((ref) => {
|
||||||
expect(() => ref.dispose()).not.toThrow();
|
expect(() => ref.destroy()).not.toThrow();
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
@ -204,7 +204,7 @@ export function main() {
|
||||||
var app = platform(BROWSER_PROVIDERS).application([BROWSER_APP_PROVIDERS, testProviders]);
|
var app = platform(BROWSER_PROVIDERS).application([BROWSER_APP_PROVIDERS, testProviders]);
|
||||||
app.bootstrap(HelloRootCmp)
|
app.bootstrap(HelloRootCmp)
|
||||||
.then((ref) => {
|
.then((ref) => {
|
||||||
ref.dispose();
|
ref.destroy();
|
||||||
expect(() => app.tick()).not.toThrow();
|
expect(() => app.tick()).not.toThrow();
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
|
@ -216,7 +216,7 @@ export function main() {
|
||||||
HelloRootCmp3, [testProviders, provide("appBinding", {useValue: "BoundValue"})]);
|
HelloRootCmp3, [testProviders, provide("appBinding", {useValue: "BoundValue"})]);
|
||||||
|
|
||||||
refPromise.then((ref) => {
|
refPromise.then((ref) => {
|
||||||
expect(ref.hostComponent.appBinding).toEqual("BoundValue");
|
expect(ref.instance.appBinding).toEqual("BoundValue");
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
@ -226,7 +226,7 @@ export function main() {
|
||||||
var refPromise = bootstrap(HelloRootCmp4, testProviders);
|
var refPromise = bootstrap(HelloRootCmp4, testProviders);
|
||||||
|
|
||||||
refPromise.then((ref) => {
|
refPromise.then((ref) => {
|
||||||
expect(ref.hostComponent.appRef).toBe((<ComponentRef_>ref).injector.get(ApplicationRef));
|
expect(ref.instance.appRef).toBe(ref.injector.get(ApplicationRef));
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import 'package:angular2/testing_internal.dart' show SpyObject;
|
import 'package:angular2/testing_internal.dart' show SpyObject;
|
||||||
import 'package:angular2/core.dart' show Injector, bind;
|
import 'package:angular2/core.dart' show Injector, bind;
|
||||||
import 'package:angular2/src/core/application_ref.dart' show ApplicationRef;
|
import 'package:angular2/src/core/application_ref.dart' show ApplicationRef;
|
||||||
import 'package:angular2/src/core/linker/dynamic_component_loader.dart'
|
import 'package:angular2/src/core/linker/component_factory.dart'
|
||||||
show ComponentRef_;
|
show ComponentRef;
|
||||||
import 'dart:js';
|
import 'dart:js';
|
||||||
|
|
||||||
@proxy
|
@proxy
|
||||||
|
@ -11,7 +11,7 @@ class SpyApplicationRef extends SpyObject implements ApplicationRef {
|
||||||
}
|
}
|
||||||
|
|
||||||
@proxy
|
@proxy
|
||||||
class SpyComponentRef extends SpyObject implements ComponentRef_ {
|
class SpyComponentRef extends SpyObject implements ComponentRef {
|
||||||
Injector injector;
|
Injector injector;
|
||||||
|
|
||||||
SpyComponentRef() {
|
SpyComponentRef() {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import {SpyObject} from 'angular2/testing_internal';
|
import {SpyObject} from 'angular2/testing_internal';
|
||||||
import {Injector, provide} from 'angular2/core';
|
import {Injector, provide} from 'angular2/core';
|
||||||
import {ComponentRef} from 'angular2/src/core/linker/dynamic_component_loader';
|
|
||||||
import {global} from 'angular2/src/facade/lang';
|
import {global} from 'angular2/src/facade/lang';
|
||||||
import {ApplicationRef, ApplicationRef_} from 'angular2/src/core/application_ref';
|
import {ApplicationRef, ApplicationRef_} from 'angular2/src/core/application_ref';
|
||||||
|
|
||||||
|
|
|
@ -158,7 +158,7 @@ var NG_CORE = [
|
||||||
'ChangeDetectionStrategy',
|
'ChangeDetectionStrategy',
|
||||||
'ChangeDetectorRef',
|
'ChangeDetectorRef',
|
||||||
'Class:js',
|
'Class:js',
|
||||||
'Compiler',
|
'ComponentResolver',
|
||||||
'Component',
|
'Component',
|
||||||
'ComponentMetadata',
|
'ComponentMetadata',
|
||||||
'ComponentRef',
|
'ComponentRef',
|
||||||
|
@ -189,7 +189,7 @@ var NG_CORE = [
|
||||||
'HostListener',
|
'HostListener',
|
||||||
'HostListenerMetadata',
|
'HostListenerMetadata',
|
||||||
'HostMetadata',
|
'HostMetadata',
|
||||||
'HostViewFactoryRef',
|
'ComponentFactory',
|
||||||
'Inject',
|
'Inject',
|
||||||
'InjectMetadata',
|
'InjectMetadata',
|
||||||
'Injectable',
|
'Injectable',
|
||||||
|
@ -270,7 +270,6 @@ var NG_CORE = [
|
||||||
'AfterViewChecked:dart',
|
'AfterViewChecked:dart',
|
||||||
'AfterViewInit:dart',
|
'AfterViewInit:dart',
|
||||||
'DoCheck:dart',
|
'DoCheck:dart',
|
||||||
'HostViewRef',
|
|
||||||
'IterableDifferFactory:dart',
|
'IterableDifferFactory:dart',
|
||||||
'IterableDiffer:dart',
|
'IterableDiffer:dart',
|
||||||
'KeyValueDifferFactory:dart',
|
'KeyValueDifferFactory:dart',
|
||||||
|
|
|
@ -69,10 +69,10 @@ export function main() {
|
||||||
provide(Console, {useClass: DummyConsole})
|
provide(Console, {useClass: DummyConsole})
|
||||||
])
|
])
|
||||||
.then((applicationRef) => {
|
.then((applicationRef) => {
|
||||||
var router = applicationRef.hostComponent.router;
|
var router = applicationRef.instance.router;
|
||||||
router.subscribe((_) => {
|
router.subscribe((_) => {
|
||||||
expect(el).toHaveText('outer { hello }');
|
expect(el).toHaveText('outer { hello }');
|
||||||
expect(applicationRef.hostComponent.location.path()).toEqual('');
|
expect(applicationRef.instance.location.path()).toEqual('');
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {Component} from 'angular2/core';
|
import {Component, ComponentRef} from 'angular2/core';
|
||||||
import {
|
import {
|
||||||
AsyncRoute,
|
AsyncRoute,
|
||||||
Route,
|
Route,
|
||||||
|
@ -10,10 +10,7 @@ import {
|
||||||
} from 'angular2/router';
|
} from 'angular2/router';
|
||||||
import {PromiseWrapper} from 'angular2/src/facade/async';
|
import {PromiseWrapper} from 'angular2/src/facade/async';
|
||||||
import {isPresent} from 'angular2/src/facade/lang';
|
import {isPresent} from 'angular2/src/facade/lang';
|
||||||
import {
|
import {DynamicComponentLoader} from 'angular2/src/core/linker/dynamic_component_loader';
|
||||||
DynamicComponentLoader,
|
|
||||||
ComponentRef
|
|
||||||
} from 'angular2/src/core/linker/dynamic_component_loader';
|
|
||||||
import {ElementRef} from 'angular2/src/core/linker/element_ref';
|
import {ElementRef} from 'angular2/src/core/linker/element_ref';
|
||||||
|
|
||||||
@Component({selector: 'goodbye-cmp', template: `{{farewell}}`})
|
@Component({selector: 'goodbye-cmp', template: `{{farewell}}`})
|
||||||
|
@ -152,7 +149,7 @@ export class DynamicLoaderCmp {
|
||||||
|
|
||||||
onSomeAction(): Promise<any> {
|
onSomeAction(): Promise<any> {
|
||||||
if (isPresent(this._componentRef)) {
|
if (isPresent(this._componentRef)) {
|
||||||
this._componentRef.dispose();
|
this._componentRef.destroy();
|
||||||
this._componentRef = null;
|
this._componentRef = null;
|
||||||
}
|
}
|
||||||
return this._dynamicComponentLoader.loadIntoLocation(DynamicallyLoadedComponent,
|
return this._dynamicComponentLoader.loadIntoLocation(DynamicallyLoadedComponent,
|
||||||
|
|
|
@ -58,10 +58,10 @@ export function main() {
|
||||||
it('should bootstrap an app with a hierarchy', inject([AsyncTestCompleter], (async) => {
|
it('should bootstrap an app with a hierarchy', inject([AsyncTestCompleter], (async) => {
|
||||||
bootstrap(HierarchyAppCmp, testBindings)
|
bootstrap(HierarchyAppCmp, testBindings)
|
||||||
.then((applicationRef) => {
|
.then((applicationRef) => {
|
||||||
var router = applicationRef.hostComponent.router;
|
var router = applicationRef.instance.router;
|
||||||
router.subscribe((_) => {
|
router.subscribe((_) => {
|
||||||
expect(el).toHaveText('root { parent { hello } }');
|
expect(el).toHaveText('root { parent { hello } }');
|
||||||
expect(applicationRef.hostComponent.location.path()).toEqual('/parent/child');
|
expect(applicationRef.instance.location.path()).toEqual('/parent/child');
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
router.navigateByUrl('/parent/child');
|
router.navigateByUrl('/parent/child');
|
||||||
|
@ -72,10 +72,10 @@ export function main() {
|
||||||
it('should work in an app with redirects', inject([AsyncTestCompleter], (async) => {
|
it('should work in an app with redirects', inject([AsyncTestCompleter], (async) => {
|
||||||
bootstrap(RedirectAppCmp, testBindings)
|
bootstrap(RedirectAppCmp, testBindings)
|
||||||
.then((applicationRef) => {
|
.then((applicationRef) => {
|
||||||
var router = applicationRef.hostComponent.router;
|
var router = applicationRef.instance.router;
|
||||||
router.subscribe((_) => {
|
router.subscribe((_) => {
|
||||||
expect(el).toHaveText('root { hello }');
|
expect(el).toHaveText('root { hello }');
|
||||||
expect(applicationRef.hostComponent.location.path()).toEqual('/after');
|
expect(applicationRef.instance.location.path()).toEqual('/after');
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
router.navigateByUrl('/before');
|
router.navigateByUrl('/before');
|
||||||
|
@ -86,10 +86,10 @@ export function main() {
|
||||||
it('should work in an app with async components', inject([AsyncTestCompleter], (async) => {
|
it('should work in an app with async components', inject([AsyncTestCompleter], (async) => {
|
||||||
bootstrap(AsyncAppCmp, testBindings)
|
bootstrap(AsyncAppCmp, testBindings)
|
||||||
.then((applicationRef) => {
|
.then((applicationRef) => {
|
||||||
var router = applicationRef.hostComponent.router;
|
var router = applicationRef.instance.router;
|
||||||
router.subscribe((_) => {
|
router.subscribe((_) => {
|
||||||
expect(el).toHaveText('root { hello }');
|
expect(el).toHaveText('root { hello }');
|
||||||
expect(applicationRef.hostComponent.location.path()).toEqual('/hello');
|
expect(applicationRef.instance.location.path()).toEqual('/hello');
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
router.navigateByUrl('/hello');
|
router.navigateByUrl('/hello');
|
||||||
|
@ -100,10 +100,10 @@ export function main() {
|
||||||
it('should work in an app with aux routes', inject([AsyncTestCompleter], (async) => {
|
it('should work in an app with aux routes', inject([AsyncTestCompleter], (async) => {
|
||||||
bootstrap(AuxAppCmp, testBindings)
|
bootstrap(AuxAppCmp, testBindings)
|
||||||
.then((applicationRef) => {
|
.then((applicationRef) => {
|
||||||
var router = applicationRef.hostComponent.router;
|
var router = applicationRef.instance.router;
|
||||||
router.subscribe((_) => {
|
router.subscribe((_) => {
|
||||||
expect(el).toHaveText('root { hello } aside { hello }');
|
expect(el).toHaveText('root { hello } aside { hello }');
|
||||||
expect(applicationRef.hostComponent.location.path()).toEqual('/hello(aside)');
|
expect(applicationRef.instance.location.path()).toEqual('/hello(aside)');
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
router.navigateByUrl('/hello(aside)');
|
router.navigateByUrl('/hello(aside)');
|
||||||
|
@ -115,10 +115,10 @@ export function main() {
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
bootstrap(ConciseAsyncAppCmp, testBindings)
|
bootstrap(ConciseAsyncAppCmp, testBindings)
|
||||||
.then((applicationRef) => {
|
.then((applicationRef) => {
|
||||||
var router = applicationRef.hostComponent.router;
|
var router = applicationRef.instance.router;
|
||||||
router.subscribe((_) => {
|
router.subscribe((_) => {
|
||||||
expect(el).toHaveText('root { hello }');
|
expect(el).toHaveText('root { hello }');
|
||||||
expect(applicationRef.hostComponent.location.path()).toEqual('/hello');
|
expect(applicationRef.instance.location.path()).toEqual('/hello');
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
router.navigateByUrl('/hello');
|
router.navigateByUrl('/hello');
|
||||||
|
@ -130,10 +130,10 @@ export function main() {
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
bootstrap(ExplicitConstructorAppCmp, testBindings)
|
bootstrap(ExplicitConstructorAppCmp, testBindings)
|
||||||
.then((applicationRef) => {
|
.then((applicationRef) => {
|
||||||
var router = applicationRef.hostComponent.router;
|
var router = applicationRef.instance.router;
|
||||||
router.subscribe((_) => {
|
router.subscribe((_) => {
|
||||||
expect(el).toHaveText('root { hello }');
|
expect(el).toHaveText('root { hello }');
|
||||||
expect(applicationRef.hostComponent.location.path()).toEqual('/hello');
|
expect(applicationRef.instance.location.path()).toEqual('/hello');
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
router.navigateByUrl('/hello');
|
router.navigateByUrl('/hello');
|
||||||
|
|
|
@ -6,7 +6,7 @@ import {ListWrapper, Map, MapWrapper} from 'angular2/src/facade/collection';
|
||||||
import {DateWrapper, Type, print, isPresent} from 'angular2/src/facade/lang';
|
import {DateWrapper, Type, print, isPresent} from 'angular2/src/facade/lang';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Compiler,
|
ComponentResolver,
|
||||||
Component,
|
Component,
|
||||||
Directive,
|
Directive,
|
||||||
ViewContainerRef,
|
ViewContainerRef,
|
||||||
|
@ -40,7 +40,7 @@ export function main() {
|
||||||
BrowserDomAdapter.makeCurrent();
|
BrowserDomAdapter.makeCurrent();
|
||||||
bootstrap(CompilerAppComponent, _createBindings())
|
bootstrap(CompilerAppComponent, _createBindings())
|
||||||
.then((ref) => {
|
.then((ref) => {
|
||||||
var app = ref.hostComponent;
|
var app = ref.instance;
|
||||||
bindAction('#compileNoBindings',
|
bindAction('#compileNoBindings',
|
||||||
measureWrapper(() => app.compileNoBindings(), 'No Bindings'));
|
measureWrapper(() => app.compileNoBindings(), 'No Bindings'));
|
||||||
bindAction('#compileWithBindings',
|
bindAction('#compileWithBindings',
|
||||||
|
@ -91,15 +91,15 @@ class MultiplyViewResolver extends ViewResolver {
|
||||||
|
|
||||||
@Component({selector: 'app', directives: [], template: ``})
|
@Component({selector: 'app', directives: [], template: ``})
|
||||||
class CompilerAppComponent {
|
class CompilerAppComponent {
|
||||||
constructor(private _compiler: Compiler) {}
|
constructor(private _compiler: ComponentResolver) {}
|
||||||
compileNoBindings() {
|
compileNoBindings() {
|
||||||
this._compiler.clearCache();
|
this._compiler.clearCache();
|
||||||
return this._compiler.compileInHost(BenchmarkComponentNoBindings);
|
return this._compiler.resolveComponent(BenchmarkComponentNoBindings);
|
||||||
}
|
}
|
||||||
|
|
||||||
compileWithBindings() {
|
compileWithBindings() {
|
||||||
this._compiler.clearCache();
|
this._compiler.clearCache();
|
||||||
return this._compiler.compileInHost(BenchmarkComponentWithBindings);
|
return this._compiler.resolveComponent(BenchmarkComponentWithBindings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ export function main() {
|
||||||
bootstrap(AppComponent)
|
bootstrap(AppComponent)
|
||||||
.then((ref) => {
|
.then((ref) => {
|
||||||
var injector = ref.injector;
|
var injector = ref.injector;
|
||||||
var app: AppComponent = ref.hostComponent;
|
var app: AppComponent = ref.instance;
|
||||||
var appRef = injector.get(ApplicationRef);
|
var appRef = injector.get(ApplicationRef);
|
||||||
|
|
||||||
bindAction('#reset', function() {
|
bindAction('#reset', function() {
|
||||||
|
|
|
@ -113,7 +113,7 @@ export function main() {
|
||||||
bootstrap(AppComponent, _createBindings())
|
bootstrap(AppComponent, _createBindings())
|
||||||
.then((ref) => {
|
.then((ref) => {
|
||||||
var injector = ref.injector;
|
var injector = ref.injector;
|
||||||
app = ref.hostComponent;
|
app = ref.instance;
|
||||||
appRef = injector.get(ApplicationRef);
|
appRef = injector.get(ApplicationRef);
|
||||||
bindAction('#ng2DestroyDom', ng2DestroyDom);
|
bindAction('#ng2DestroyDom', ng2DestroyDom);
|
||||||
bindAction('#ng2CreateDom', ng2CreateDom);
|
bindAction('#ng2CreateDom', ng2CreateDom);
|
||||||
|
|
|
@ -1,15 +1,6 @@
|
||||||
import {bootstrap} from 'angular2/platform/browser';
|
import {bootstrap} from 'angular2/platform/browser';
|
||||||
import {NgIf} from 'angular2/common';
|
import {NgIf} from 'angular2/common';
|
||||||
import {
|
import {Component, Directive, ViewContainerRef, bind, provide, Provider} from 'angular2/core';
|
||||||
Compiler,
|
|
||||||
Component,
|
|
||||||
Directive,
|
|
||||||
ViewContainerRef,
|
|
||||||
bind,
|
|
||||||
provide,
|
|
||||||
Provider
|
|
||||||
} from 'angular2/core';
|
|
||||||
import {ComponentRef_} from 'angular2/src/core/linker/dynamic_component_loader';
|
|
||||||
import {ApplicationRef} from 'angular2/src/core/application_ref';
|
import {ApplicationRef} from 'angular2/src/core/application_ref';
|
||||||
import {reflector} from 'angular2/src/core/reflection/reflection';
|
import {reflector} from 'angular2/src/core/reflection/reflection';
|
||||||
import {ReflectionCapabilities} from 'angular2/src/core/reflection/reflection_capabilities';
|
import {ReflectionCapabilities} from 'angular2/src/core/reflection/reflection_capabilities';
|
||||||
|
@ -94,10 +85,10 @@ export function main() {
|
||||||
function initNg2() {
|
function initNg2() {
|
||||||
bootstrap(AppComponentWithStaticTree, createBindings())
|
bootstrap(AppComponentWithStaticTree, createBindings())
|
||||||
.then((ref) => {
|
.then((ref) => {
|
||||||
var injector = (<ComponentRef_>ref).injector;
|
var injector = ref.injector;
|
||||||
appRef = injector.get(ApplicationRef);
|
appRef = injector.get(ApplicationRef);
|
||||||
|
|
||||||
app = (<ComponentRef_>ref).hostComponent;
|
app = ref.instance;
|
||||||
bindAction('#ng2DestroyDom', ng2DestroyDom);
|
bindAction('#ng2DestroyDom', ng2DestroyDom);
|
||||||
bindAction('#ng2CreateDom', ng2CreateDom);
|
bindAction('#ng2CreateDom', ng2CreateDom);
|
||||||
bindAction('#ng2UpdateDomProfile', profile(ng2CreateDom, noop, 'ng2-update'));
|
bindAction('#ng2UpdateDomProfile', profile(ng2CreateDom, noop, 'ng2-update'));
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import {bootstrap} from 'angular2/platform/browser';
|
import {bootstrap} from 'angular2/platform/browser';
|
||||||
import {
|
import {
|
||||||
Compiler,
|
|
||||||
Component,
|
Component,
|
||||||
Directive,
|
Directive,
|
||||||
ViewContainerRef,
|
ViewContainerRef,
|
||||||
|
@ -96,7 +95,7 @@ export function main() {
|
||||||
var injector = ref.injector;
|
var injector = ref.injector;
|
||||||
appRef = injector.get(ApplicationRef);
|
appRef = injector.get(ApplicationRef);
|
||||||
|
|
||||||
app = ref.hostComponent;
|
app = ref.instance;
|
||||||
bindAction('#ng2DestroyDom', ng2DestroyDom);
|
bindAction('#ng2DestroyDom', ng2DestroyDom);
|
||||||
bindAction('#ng2CreateDom', ng2CreateDom);
|
bindAction('#ng2CreateDom', ng2CreateDom);
|
||||||
bindAction('#ng2UpdateDomProfile', profile(ng2CreateDom, noop, 'ng2-update'));
|
bindAction('#ng2UpdateDomProfile', profile(ng2CreateDom, noop, 'ng2-update'));
|
||||||
|
|
|
@ -66,7 +66,7 @@ Future<Outputs> processTemplates(AssetReader reader, AssetId assetId,
|
||||||
for (var reflectable in viewDefResults.viewDefinitions.keys) {
|
for (var reflectable in viewDefResults.viewDefinitions.keys) {
|
||||||
// TODO(kegluneq): Avoid duplicating naming logic for generated classes.
|
// TODO(kegluneq): Avoid duplicating naming logic for generated classes.
|
||||||
reflectable.annotations.add(new AnnotationModel()
|
reflectable.annotations.add(new AnnotationModel()
|
||||||
..name = 'hostViewFactory_${reflectable.name}'
|
..name = '${reflectable.name}NgFactory'
|
||||||
..isConstObject = true);
|
..isConstObject = true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ void initReflector() {
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerType(
|
..registerType(
|
||||||
MyComponent,
|
MyComponent,
|
||||||
new _ngRef.ReflectionInfo(const [hostViewFactory_MyComponent], const [],
|
new _ngRef.ReflectionInfo(const [MyComponentNgFactory], const [],
|
||||||
() => new MyComponent()));
|
() => new MyComponent()));
|
||||||
i0.initReflector();
|
i0.initReflector();
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ void initReflector() {
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerType(
|
..registerType(
|
||||||
MyComponent,
|
MyComponent,
|
||||||
new _ngRef.ReflectionInfo(const [hostViewFactory_MyComponent], const [],
|
new _ngRef.ReflectionInfo(const [MyComponentNgFactory], const [],
|
||||||
() => new MyComponent()));
|
() => new MyComponent()));
|
||||||
i0.initReflector();
|
i0.initReflector();
|
||||||
i1.initReflector();
|
i1.initReflector();
|
||||||
|
|
|
@ -15,7 +15,7 @@ void initReflector() {
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerType(
|
..registerType(
|
||||||
MyComponent,
|
MyComponent,
|
||||||
new _ngRef.ReflectionInfo(const [hostViewFactory_MyComponent], const [],
|
new _ngRef.ReflectionInfo(const [MyComponentNgFactory], const [],
|
||||||
() => new MyComponent()));
|
() => new MyComponent()));
|
||||||
i0.initReflector();
|
i0.initReflector();
|
||||||
i1.initReflector();
|
i1.initReflector();
|
||||||
|
|
|
@ -15,7 +15,7 @@ void initReflector() {
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerType(
|
..registerType(
|
||||||
MyComponent,
|
MyComponent,
|
||||||
new _ngRef.ReflectionInfo(const [hostViewFactory_MyComponent], const [],
|
new _ngRef.ReflectionInfo(const [MyComponentNgFactory], const [],
|
||||||
() => new MyComponent()));
|
() => new MyComponent()));
|
||||||
i0.initReflector();
|
i0.initReflector();
|
||||||
i1.initReflector();
|
i1.initReflector();
|
||||||
|
|
|
@ -15,7 +15,7 @@ void initReflector() {
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerType(
|
..registerType(
|
||||||
MyComponent,
|
MyComponent,
|
||||||
new _ngRef.ReflectionInfo(const [hostViewFactory_MyComponent], const [
|
new _ngRef.ReflectionInfo(const [MyComponentNgFactory], const [
|
||||||
const [MyContext]
|
const [MyContext]
|
||||||
], (MyContext c) => new MyComponent(c)));
|
], (MyContext c) => new MyComponent(c)));
|
||||||
i0.initReflector();
|
i0.initReflector();
|
||||||
|
|
|
@ -13,7 +13,7 @@ void initReflector() {
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerType(
|
..registerType(
|
||||||
MyComponent,
|
MyComponent,
|
||||||
new _ngRef.ReflectionInfo(const [hostViewFactory_MyComponent], const [],
|
new _ngRef.ReflectionInfo(const [MyComponentNgFactory], const [],
|
||||||
() => new MyComponent()));
|
() => new MyComponent()));
|
||||||
i0.initReflector();
|
i0.initReflector();
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ void initReflector() {
|
||||||
_ngRef.reflector
|
_ngRef.reflector
|
||||||
..registerType(
|
..registerType(
|
||||||
MyComponent,
|
MyComponent,
|
||||||
new _ngRef.ReflectionInfo(const [hostViewFactory_MyComponent], const [],
|
new _ngRef.ReflectionInfo(const [MyComponentNgFactory], const [],
|
||||||
() => new MyComponent()));
|
() => new MyComponent()));
|
||||||
i0.initReflector();
|
i0.initReflector();
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ void initReflector() {
|
||||||
new _ngRef.ReflectionInfo(const [
|
new _ngRef.ReflectionInfo(const [
|
||||||
const Annotation1(prop1: 'value1'),
|
const Annotation1(prop1: 'value1'),
|
||||||
const Annotation2(prop2: 'value2'),
|
const Annotation2(prop2: 'value2'),
|
||||||
hostViewFactory_MyComponent
|
MyComponentNgFactory
|
||||||
], const [], () => new MyComponent()));
|
], const [], () => new MyComponent()));
|
||||||
i0.initReflector();
|
i0.initReflector();
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ void initReflector() {
|
||||||
..registerType(
|
..registerType(
|
||||||
MyComponent,
|
MyComponent,
|
||||||
new _ngRef.ReflectionInfo(
|
new _ngRef.ReflectionInfo(
|
||||||
const [hostViewFactory_MyComponent],
|
const [MyComponentNgFactory],
|
||||||
const [
|
const [
|
||||||
const [prefix.MyContext],
|
const [prefix.MyContext],
|
||||||
const [prefix.MyDep]
|
const [prefix.MyDep]
|
||||||
|
|
|
@ -114,7 +114,7 @@ void allTests() {
|
||||||
expect(ngDeps).toBeNotNull();
|
expect(ngDeps).toBeNotNull();
|
||||||
expect(ngDeps.reflectables.first.annotations)
|
expect(ngDeps.reflectables.first.annotations)
|
||||||
.toContain(new AnnotationModel()
|
.toContain(new AnnotationModel()
|
||||||
..name = 'hostViewFactory_FooComponent'
|
..name = 'FooComponentNgFactory'
|
||||||
..isConstObject = true);
|
..isConstObject = true);
|
||||||
expect(_generatedCode(outputs))
|
expect(_generatedCode(outputs))
|
||||||
..toContain('$CONTEXT_ACCESSOR.greeting')
|
..toContain('$CONTEXT_ACCESSOR.greeting')
|
||||||
|
@ -132,7 +132,7 @@ void allTests() {
|
||||||
expect(ngDeps).toBeNotNull();
|
expect(ngDeps).toBeNotNull();
|
||||||
expect(ngDeps.reflectables.first.annotations)
|
expect(ngDeps.reflectables.first.annotations)
|
||||||
.toContain(new AnnotationModel()
|
.toContain(new AnnotationModel()
|
||||||
..name = 'hostViewFactory_FooComponent'
|
..name = 'FooComponentNgFactory'
|
||||||
..isConstObject = true);
|
..isConstObject = true);
|
||||||
expect(_generatedCode(outputs))..toContain('$CONTEXT_ACCESSOR.action()');
|
expect(_generatedCode(outputs))..toContain('$CONTEXT_ACCESSOR.action()');
|
||||||
});
|
});
|
||||||
|
@ -158,7 +158,7 @@ void allTests() {
|
||||||
expect(ngDeps).toBeNotNull();
|
expect(ngDeps).toBeNotNull();
|
||||||
expect(ngDeps.reflectables.first.annotations)
|
expect(ngDeps.reflectables.first.annotations)
|
||||||
.toContain(new AnnotationModel()
|
.toContain(new AnnotationModel()
|
||||||
..name = 'hostViewFactory_FooComponent'
|
..name = 'FooComponentNgFactory'
|
||||||
..isConstObject = true);
|
..isConstObject = true);
|
||||||
|
|
||||||
expect(_generatedCode(outputs))
|
expect(_generatedCode(outputs))
|
||||||
|
@ -188,7 +188,7 @@ void allTests() {
|
||||||
expect(ngDeps).toBeNotNull();
|
expect(ngDeps).toBeNotNull();
|
||||||
expect(ngDeps.reflectables.first.annotations)
|
expect(ngDeps.reflectables.first.annotations)
|
||||||
.toContain(new AnnotationModel()
|
.toContain(new AnnotationModel()
|
||||||
..name = 'hostViewFactory_FooComponent'
|
..name = 'FooComponentNgFactory'
|
||||||
..isConstObject = true);
|
..isConstObject = true);
|
||||||
|
|
||||||
expect(_generatedCode(outputs))
|
expect(_generatedCode(outputs))
|
||||||
|
@ -216,7 +216,7 @@ void allTests() {
|
||||||
expect(ngDeps).toBeNotNull();
|
expect(ngDeps).toBeNotNull();
|
||||||
expect(ngDeps.reflectables.first.annotations)
|
expect(ngDeps.reflectables.first.annotations)
|
||||||
.toContain(new AnnotationModel()
|
.toContain(new AnnotationModel()
|
||||||
..name = 'hostViewFactory_FooComponent'
|
..name = 'FooComponentNgFactory'
|
||||||
..isConstObject = true);
|
..isConstObject = true);
|
||||||
|
|
||||||
expect(_generatedCode(outputs))
|
expect(_generatedCode(outputs))
|
||||||
|
|
|
@ -29,10 +29,6 @@ const CORE = [
|
||||||
'AfterViewInit',
|
'AfterViewInit',
|
||||||
'AfterViewInit.ngAfterViewInit():any',
|
'AfterViewInit.ngAfterViewInit():any',
|
||||||
'AppViewManager',
|
'AppViewManager',
|
||||||
'AppViewManager.createRootHostView(hostViewFactoryRef:HostViewFactoryRef, overrideSelector:string, injector:Injector, projectableNodes:any[][]):HostViewRef',
|
|
||||||
'AppViewManager.destroyRootHostView(hostViewRef:HostViewRef):any',
|
|
||||||
'AppViewManager.getComponent(hostLocation:ElementRef):any',
|
|
||||||
'AppViewManager.getHostElement(hostViewRef:HostViewRef):ElementRef',
|
|
||||||
'AppViewManager.getNamedElementInComponentView(hostLocation:ElementRef, variableName:string):ElementRef',
|
'AppViewManager.getNamedElementInComponentView(hostLocation:ElementRef, variableName:string):ElementRef',
|
||||||
'AppViewManager.getViewContainer(location:ElementRef):ViewContainerRef',
|
'AppViewManager.getViewContainer(location:ElementRef):ViewContainerRef',
|
||||||
'ApplicationRef',
|
'ApplicationRef',
|
||||||
|
@ -44,7 +40,7 @@ const CORE = [
|
||||||
'ApplicationRef.registerDisposeListener(dispose:() => void):void',
|
'ApplicationRef.registerDisposeListener(dispose:() => void):void',
|
||||||
'ApplicationRef.tick():void',
|
'ApplicationRef.tick():void',
|
||||||
'ApplicationRef.zone:NgZone',
|
'ApplicationRef.zone:NgZone',
|
||||||
'AttributeFactory',
|
'AttributeMetadataFactory',
|
||||||
'AttributeMetadata',
|
'AttributeMetadata',
|
||||||
'AttributeMetadata.constructor(attributeName:string)',
|
'AttributeMetadata.constructor(attributeName:string)',
|
||||||
'AttributeMetadata.toString():string',
|
'AttributeMetadata.toString():string',
|
||||||
|
@ -77,12 +73,12 @@ const CORE = [
|
||||||
'CollectionChangeRecord.currentIndex:number',
|
'CollectionChangeRecord.currentIndex:number',
|
||||||
'CollectionChangeRecord.previousIndex:number',
|
'CollectionChangeRecord.previousIndex:number',
|
||||||
'CollectionChangeRecord.toString():string',
|
'CollectionChangeRecord.toString():string',
|
||||||
'Compiler',
|
'ComponentResolver',
|
||||||
'Compiler.clearCache():any',
|
'ComponentResolver.clearCache():any',
|
||||||
'Compiler.compileInHost(componentType:Type):Promise<HostViewFactoryRef>',
|
'ComponentResolver.resolveComponent(componentType:Type):Promise<ComponentFactory>',
|
||||||
'ComponentDecorator',
|
'ComponentDecorator',
|
||||||
'ComponentDecorator.View(obj:{templateUrl?:string, template?:string, directives?:Array<Type|any[]>, pipes?:Array<Type|any[]>, renderer?:string, styles?:string[], styleUrls?:string[]}):ViewDecorator',
|
'ComponentDecorator.View(obj:{templateUrl?:string, template?:string, directives?:Array<Type|any[]>, pipes?:Array<Type|any[]>, renderer?:string, styles?:string[], styleUrls?:string[]}):ViewDecorator',
|
||||||
'ComponentFactory',
|
'ComponentMetadataFactory',
|
||||||
'ComponentMetadata',
|
'ComponentMetadata',
|
||||||
'ComponentMetadata.changeDetection:ChangeDetectionStrategy',
|
'ComponentMetadata.changeDetection:ChangeDetectionStrategy',
|
||||||
'ComponentMetadata.constructor({selector,inputs,outputs,properties,events,host,exportAs,moduleId,bindings,providers,viewBindings,viewProviders,changeDetection=ChangeDetectionStrategy.Default,queries,templateUrl,template,styleUrls,styles,directives,pipes,encapsulation}:{selector?:string, inputs?:string[], outputs?:string[], properties?:string[], events?:string[], host?:{[key:string]:string}, bindings?:any[], providers?:any[], exportAs?:string, moduleId?:string, viewBindings?:any[], viewProviders?:any[], queries?:{[key:string]:any}, changeDetection?:ChangeDetectionStrategy, templateUrl?:string, template?:string, styleUrls?:string[], styles?:string[], directives?:Array<Type|any[]>, pipes?:Array<Type|any[]>, encapsulation?:ViewEncapsulation})',
|
'ComponentMetadata.constructor({selector,inputs,outputs,properties,events,host,exportAs,moduleId,bindings,providers,viewBindings,viewProviders,changeDetection=ChangeDetectionStrategy.Default,queries,templateUrl,template,styleUrls,styles,directives,pipes,encapsulation}:{selector?:string, inputs?:string[], outputs?:string[], properties?:string[], events?:string[], host?:{[key:string]:string}, bindings?:any[], providers?:any[], exportAs?:string, moduleId?:string, viewBindings?:any[], viewProviders?:any[], queries?:{[key:string]:any}, changeDetection?:ChangeDetectionStrategy, templateUrl?:string, template?:string, styleUrls?:string[], styles?:string[], directives?:Array<Type|any[]>, pipes?:Array<Type|any[]>, encapsulation?:ViewEncapsulation})',
|
||||||
|
@ -98,17 +94,18 @@ const CORE = [
|
||||||
'ComponentMetadata.viewProviders:any[]',
|
'ComponentMetadata.viewProviders:any[]',
|
||||||
'ComponentRef',
|
'ComponentRef',
|
||||||
'ComponentRef.componentType:Type',
|
'ComponentRef.componentType:Type',
|
||||||
'ComponentRef.dispose():void',
|
|
||||||
'ComponentRef.hostComponent:any',
|
|
||||||
'ComponentRef.hostView:HostViewRef',
|
|
||||||
'ComponentRef.injector:Injector',
|
'ComponentRef.injector:Injector',
|
||||||
'ComponentRef.instance:any',
|
'ComponentRef.instance:any',
|
||||||
'ComponentRef.location:ElementRef',
|
'ComponentRef.location:ElementRef',
|
||||||
|
'ComponentRef.destroy():void',
|
||||||
|
'ComponentRef.hostView:ViewRef',
|
||||||
|
'ComponentRef.onDestroy(callback:Function):void',
|
||||||
|
'ComponentRef.changeDetectorRef:ChangeDetectorRef',
|
||||||
'ConcreteType',
|
'ConcreteType',
|
||||||
'ContentChildFactory',
|
'ContentChildMetadataFactory',
|
||||||
'ContentChildMetadata',
|
'ContentChildMetadata',
|
||||||
'ContentChildMetadata.constructor(_selector:Type|string)',
|
'ContentChildMetadata.constructor(_selector:Type|string)',
|
||||||
'ContentChildrenFactory',
|
'ContentChildrenMetadataFactory',
|
||||||
'ContentChildrenMetadata',
|
'ContentChildrenMetadata',
|
||||||
'ContentChildrenMetadata.constructor(_selector:Type|string, {descendants=false}:{descendants?:boolean})',
|
'ContentChildrenMetadata.constructor(_selector:Type|string, {descendants=false}:{descendants?:boolean})',
|
||||||
'CyclicDependencyError',
|
'CyclicDependencyError',
|
||||||
|
@ -147,7 +144,7 @@ const CORE = [
|
||||||
'DependencyMetadata',
|
'DependencyMetadata',
|
||||||
'DependencyMetadata.token:any',
|
'DependencyMetadata.token:any',
|
||||||
'DirectiveDecorator',
|
'DirectiveDecorator',
|
||||||
'DirectiveFactory',
|
'DirectiveMetadataFactory',
|
||||||
'DirectiveMetadata',
|
'DirectiveMetadata',
|
||||||
'DirectiveMetadata.bindings:any[]',
|
'DirectiveMetadata.bindings:any[]',
|
||||||
'DirectiveMetadata.constructor({selector,inputs,outputs,properties,events,host,bindings,providers,exportAs,queries}:{selector?:string, inputs?:string[], outputs?:string[], properties?:string[], events?:string[], host?:{[key:string]:string}, providers?:any[], bindings?:any[], exportAs?:string, queries?:{[key:string]:any}})',
|
'DirectiveMetadata.constructor({selector,inputs,outputs,properties,events,host,bindings,providers,exportAs,queries}:{selector?:string, inputs?:string[], outputs?:string[], properties?:string[], events?:string[], host?:{[key:string]:string}, providers?:any[], bindings?:any[], exportAs?:string, queries?:{[key:string]:any}})',
|
||||||
|
@ -163,7 +160,7 @@ const CORE = [
|
||||||
'DoCheck',
|
'DoCheck',
|
||||||
'DoCheck.ngDoCheck():any',
|
'DoCheck.ngDoCheck():any',
|
||||||
'DynamicComponentLoader',
|
'DynamicComponentLoader',
|
||||||
'DynamicComponentLoader.loadAsRoot(type:Type, overrideSelector:string, injector:Injector, onDispose:() => void, projectableNodes:any[][]):Promise<ComponentRef>',
|
'DynamicComponentLoader.loadAsRoot(type:Type, overrideSelectorOrNode:string, injector:Injector, onDispose:() => void, projectableNodes:any[][]):Promise<ComponentRef>',
|
||||||
'DynamicComponentLoader.loadIntoLocation(type:Type, hostLocation:ElementRef, anchorName:string, providers:ResolvedProvider[], projectableNodes:any[][]):Promise<ComponentRef>',
|
'DynamicComponentLoader.loadIntoLocation(type:Type, hostLocation:ElementRef, anchorName:string, providers:ResolvedProvider[], projectableNodes:any[][]):Promise<ComponentRef>',
|
||||||
'DynamicComponentLoader.loadNextToLocation(type:Type, location:ElementRef, providers:ResolvedProvider[], projectableNodes:any[][]):Promise<ComponentRef>',
|
'DynamicComponentLoader.loadNextToLocation(type:Type, location:ElementRef, providers:ResolvedProvider[], projectableNodes:any[][]):Promise<ComponentRef>',
|
||||||
'ElementRef',
|
'ElementRef',
|
||||||
|
@ -172,6 +169,7 @@ const CORE = [
|
||||||
'EmbeddedViewRef.hasLocal(variableName:string):boolean',
|
'EmbeddedViewRef.hasLocal(variableName:string):boolean',
|
||||||
'EmbeddedViewRef.rootNodes:any[]',
|
'EmbeddedViewRef.rootNodes:any[]',
|
||||||
'EmbeddedViewRef.setLocal(variableName:string, value:any):void',
|
'EmbeddedViewRef.setLocal(variableName:string, value:any):void',
|
||||||
|
'EmbeddedViewRef.destroy():any',
|
||||||
'EventEmitter.constructor(isAsync:boolean)',
|
'EventEmitter.constructor(isAsync:boolean)',
|
||||||
'EventEmitter.emit(value:T):any',
|
'EventEmitter.emit(value:T):any',
|
||||||
'EventEmitter.next(value:any):any',
|
'EventEmitter.next(value:any):any',
|
||||||
|
@ -187,23 +185,24 @@ const CORE = [
|
||||||
'GetTestability',
|
'GetTestability',
|
||||||
'GetTestability.addToWindow(registry:TestabilityRegistry):void',
|
'GetTestability.addToWindow(registry:TestabilityRegistry):void',
|
||||||
'GetTestability.findTestabilityInTree(registry:TestabilityRegistry, elem:any, findInAncestors:boolean):Testability',
|
'GetTestability.findTestabilityInTree(registry:TestabilityRegistry, elem:any, findInAncestors:boolean):Testability',
|
||||||
'HostBindingFactory',
|
'HostBindingMetadataFactory',
|
||||||
'HostBindingMetadata',
|
'HostBindingMetadata',
|
||||||
'HostBindingMetadata.constructor(hostPropertyName:string)',
|
'HostBindingMetadata.constructor(hostPropertyName:string)',
|
||||||
'HostFactory',
|
'HostMetadataFactory',
|
||||||
'HostListenerFactory',
|
'HostListenerMetadataFactory',
|
||||||
'HostListenerMetadata',
|
'HostListenerMetadata',
|
||||||
'HostListenerMetadata.constructor(eventName:string, args:string[])',
|
'HostListenerMetadata.constructor(eventName:string, args:string[])',
|
||||||
'HostMetadata',
|
'HostMetadata',
|
||||||
'HostMetadata.toString():string',
|
'HostMetadata.toString():string',
|
||||||
'HostViewFactoryRef',
|
'ComponentFactory',
|
||||||
'HostViewRef',
|
'ComponentFactory.componentType:Type',
|
||||||
'HostViewRef.rootNodes:any[]',
|
'ComponentFactory.constructor(selector:string, _viewFactory:Function, _componentType:Type)',
|
||||||
'InjectFactory',
|
'ComponentFactory.create(injector:Injector, projectableNodes:any[][], rootSelectorOrNode:string|any):ComponentRef',
|
||||||
|
'InjectMetadataFactory',
|
||||||
'InjectMetadata',
|
'InjectMetadata',
|
||||||
'InjectMetadata.constructor(token:any)',
|
'InjectMetadata.constructor(token:any)',
|
||||||
'InjectMetadata.toString():string',
|
'InjectMetadata.toString():string',
|
||||||
'InjectableFactory',
|
'InjectableMetadataFactory',
|
||||||
'InjectableMetadata',
|
'InjectableMetadata',
|
||||||
'InjectableMetadata.constructor()',
|
'InjectableMetadata.constructor()',
|
||||||
'Injector',
|
'Injector',
|
||||||
|
@ -219,7 +218,7 @@ const CORE = [
|
||||||
'Injector.resolveAndCreate(providers:Array<Type|Provider|any[]>):Injector',
|
'Injector.resolveAndCreate(providers:Array<Type|Provider|any[]>):Injector',
|
||||||
'Injector.resolveAndCreateChild(providers:Array<Type|Provider|any[]>):Injector',
|
'Injector.resolveAndCreateChild(providers:Array<Type|Provider|any[]>):Injector',
|
||||||
'Injector.resolveAndInstantiate(provider:Type|Provider):any',
|
'Injector.resolveAndInstantiate(provider:Type|Provider):any',
|
||||||
'InputFactory',
|
'InputMetadataFactory',
|
||||||
'InputMetadata',
|
'InputMetadata',
|
||||||
'InputMetadata.constructor(bindingPropertyName:string)',
|
'InputMetadata.constructor(bindingPropertyName:string)',
|
||||||
'InstantiationError',
|
'InstantiationError',
|
||||||
|
@ -292,15 +291,15 @@ const CORE = [
|
||||||
'OpaqueToken',
|
'OpaqueToken',
|
||||||
'OpaqueToken.constructor(_desc:string)',
|
'OpaqueToken.constructor(_desc:string)',
|
||||||
'OpaqueToken.toString():string',
|
'OpaqueToken.toString():string',
|
||||||
'OptionalFactory',
|
'OptionalMetadataFactory',
|
||||||
'OptionalMetadata',
|
'OptionalMetadata',
|
||||||
'OptionalMetadata.toString():string',
|
'OptionalMetadata.toString():string',
|
||||||
'OutOfBoundsError',
|
'OutOfBoundsError',
|
||||||
'OutOfBoundsError.constructor(index:any)',
|
'OutOfBoundsError.constructor(index:any)',
|
||||||
'OutputFactory',
|
'OutputMetadataFactory',
|
||||||
'OutputMetadata',
|
'OutputMetadata',
|
||||||
'OutputMetadata.constructor(bindingPropertyName:string)',
|
'OutputMetadata.constructor(bindingPropertyName:string)',
|
||||||
'PipeFactory',
|
'PipeMetadataFactory',
|
||||||
'PipeMetadata',
|
'PipeMetadata',
|
||||||
'PipeMetadata.constructor({name,pure}:{name:string, pure?:boolean})',
|
'PipeMetadata.constructor({name,pure}:{name:string, pure?:boolean})',
|
||||||
'PipeMetadata.name:string',
|
'PipeMetadata.name:string',
|
||||||
|
@ -328,7 +327,7 @@ const CORE = [
|
||||||
'ProviderBuilder.toClass(type:Type):Provider',
|
'ProviderBuilder.toClass(type:Type):Provider',
|
||||||
'ProviderBuilder.toFactory(factory:Function, dependencies:any[]):Provider',
|
'ProviderBuilder.toFactory(factory:Function, dependencies:any[]):Provider',
|
||||||
'ProviderBuilder.toValue(value:any):Provider',
|
'ProviderBuilder.toValue(value:any):Provider',
|
||||||
'QueryFactory',
|
'QueryMetadataFactory',
|
||||||
'QueryList.changes:Observable<any>',
|
'QueryList.changes:Observable<any>',
|
||||||
'QueryList.dirty:any',
|
'QueryList.dirty:any',
|
||||||
'QueryList.filter(fn:(item: T) => boolean):T[]',
|
'QueryList.filter(fn:(item: T) => boolean):T[]',
|
||||||
|
@ -389,7 +388,7 @@ const CORE = [
|
||||||
'Renderer.listen(renderElement:any, name:string, callback:Function):Function',
|
'Renderer.listen(renderElement:any, name:string, callback:Function):Function',
|
||||||
'Renderer.listenGlobal(target:string, name:string, callback:Function):Function',
|
'Renderer.listenGlobal(target:string, name:string, callback:Function):Function',
|
||||||
'Renderer.projectNodes(parentElement:any, nodes:any[]):void',
|
'Renderer.projectNodes(parentElement:any, nodes:any[]):void',
|
||||||
'Renderer.selectRootElement(selector:string, debugInfo:RenderDebugInfo):any',
|
'Renderer.selectRootElement(selectorOrNode:string|any, debugInfo:RenderDebugInfo):any',
|
||||||
'Renderer.setBindingDebugInfo(renderElement:any, propertyName:string, propertyValue:string):void',
|
'Renderer.setBindingDebugInfo(renderElement:any, propertyName:string, propertyValue:string):void',
|
||||||
'Renderer.setElementAttribute(renderElement:any, attributeName:string, attributeValue:string):void',
|
'Renderer.setElementAttribute(renderElement:any, attributeName:string, attributeValue:string):void',
|
||||||
'Renderer.setElementClass(renderElement:any, className:string, isAdd:boolean):any',
|
'Renderer.setElementClass(renderElement:any, className:string, isAdd:boolean):any',
|
||||||
|
@ -405,17 +404,18 @@ const CORE = [
|
||||||
'ResolvedProvider.resolvedFactories:ResolvedFactory[]',
|
'ResolvedProvider.resolvedFactories:ResolvedFactory[]',
|
||||||
'RootRenderer',
|
'RootRenderer',
|
||||||
'RootRenderer.renderComponent(componentType:RenderComponentType):Renderer',
|
'RootRenderer.renderComponent(componentType:RenderComponentType):Renderer',
|
||||||
'SelfFactory',
|
'SelfMetadataFactory',
|
||||||
'SelfMetadata',
|
'SelfMetadata',
|
||||||
'SelfMetadata.toString():string',
|
'SelfMetadata.toString():string',
|
||||||
'SimpleChange',
|
'SimpleChange',
|
||||||
'SimpleChange.constructor(previousValue:any, currentValue:any)',
|
'SimpleChange.constructor(previousValue:any, currentValue:any)',
|
||||||
'SimpleChange.isFirstChange():boolean',
|
'SimpleChange.isFirstChange():boolean',
|
||||||
'SkipSelfFactory',
|
'SkipSelfMetadataFactory',
|
||||||
'SkipSelfMetadata',
|
'SkipSelfMetadata',
|
||||||
'SkipSelfMetadata.toString():string',
|
'SkipSelfMetadata.toString():string',
|
||||||
'TemplateRef',
|
'TemplateRef',
|
||||||
'TemplateRef.elementRef:ElementRef',
|
'TemplateRef.elementRef:ElementRef',
|
||||||
|
'TemplateRef.createEmbeddedView():EmbeddedViewRef',
|
||||||
'Testability',
|
'Testability',
|
||||||
'Testability.constructor(_ngZone:NgZone)',
|
'Testability.constructor(_ngZone:NgZone)',
|
||||||
'Testability.decreasePendingRequestCount():number',
|
'Testability.decreasePendingRequestCount():number',
|
||||||
|
@ -436,16 +436,16 @@ const CORE = [
|
||||||
'TypeDecorator',
|
'TypeDecorator',
|
||||||
'TypeDecorator.Class(obj:ClassDefinition):ConcreteType',
|
'TypeDecorator.Class(obj:ClassDefinition):ConcreteType',
|
||||||
'TypeDecorator.annotations:any[]',
|
'TypeDecorator.annotations:any[]',
|
||||||
'ViewChildFactory',
|
'ViewChildMetadataFactory',
|
||||||
'ViewChildMetadata',
|
'ViewChildMetadata',
|
||||||
'ViewChildMetadata.constructor(_selector:Type|string)',
|
'ViewChildMetadata.constructor(_selector:Type|string)',
|
||||||
'ViewChildrenFactory',
|
'ViewChildrenMetadataFactory',
|
||||||
'ViewChildrenMetadata',
|
'ViewChildrenMetadata',
|
||||||
'ViewChildrenMetadata.constructor(_selector:Type|string)',
|
'ViewChildrenMetadata.constructor(_selector:Type|string)',
|
||||||
'ViewContainerRef',
|
'ViewContainerRef',
|
||||||
'ViewContainerRef.clear():void',
|
'ViewContainerRef.clear():void',
|
||||||
'ViewContainerRef.createEmbeddedView(templateRef:TemplateRef, index:number):EmbeddedViewRef',
|
'ViewContainerRef.createEmbeddedView(templateRef:TemplateRef, index:number):EmbeddedViewRef',
|
||||||
'ViewContainerRef.createHostView(hostViewFactoryRef:HostViewFactoryRef, index:number, dynamicallyCreatedProviders:ResolvedProvider[], projectableNodes:any[][]):HostViewRef',
|
'ViewContainerRef.createComponent(componentFactory:ComponentFactory, index:number, dynamicallyCreatedProviders:ResolvedProvider[], projectableNodes:any[][]):ComponentRef',
|
||||||
'ViewContainerRef.detach(index:number):ViewRef',
|
'ViewContainerRef.detach(index:number):ViewRef',
|
||||||
'ViewContainerRef.element:ElementRef',
|
'ViewContainerRef.element:ElementRef',
|
||||||
'ViewContainerRef.get(index:number):ViewRef',
|
'ViewContainerRef.get(index:number):ViewRef',
|
||||||
|
@ -459,7 +459,7 @@ const CORE = [
|
||||||
'ViewEncapsulation.Emulated',
|
'ViewEncapsulation.Emulated',
|
||||||
'ViewEncapsulation.Native',
|
'ViewEncapsulation.Native',
|
||||||
'ViewEncapsulation.None',
|
'ViewEncapsulation.None',
|
||||||
'ViewFactory',
|
'ViewMetadataFactory',
|
||||||
'ViewMetadata',
|
'ViewMetadata',
|
||||||
'ViewMetadata.constructor({templateUrl,template,directives,pipes,encapsulation,styles,styleUrls}:{templateUrl?:string, template?:string, directives?:Array<Type|any[]>, pipes?:Array<Type|any[]>, encapsulation?:ViewEncapsulation, styles?:string[], styleUrls?:string[]})',
|
'ViewMetadata.constructor({templateUrl,template,directives,pipes,encapsulation,styles,styleUrls}:{templateUrl?:string, template?:string, directives?:Array<Type|any[]>, pipes?:Array<Type|any[]>, encapsulation?:ViewEncapsulation, styles?:string[], styleUrls?:string[]})',
|
||||||
'ViewMetadata.directives:Array<Type|any[]>',
|
'ViewMetadata.directives:Array<Type|any[]>',
|
||||||
|
@ -476,6 +476,7 @@ const CORE = [
|
||||||
'ViewRef',
|
'ViewRef',
|
||||||
'ViewRef.changeDetectorRef:ChangeDetectorRef',
|
'ViewRef.changeDetectorRef:ChangeDetectorRef',
|
||||||
'ViewRef.destroyed:boolean',
|
'ViewRef.destroyed:boolean',
|
||||||
|
'ViewRef.onDestroy(callback:Function):any',
|
||||||
'WrappedException',
|
'WrappedException',
|
||||||
'WrappedException.constructor(_wrapperMessage:string, _originalException:any, _originalStack:any, _context:any)',
|
'WrappedException.constructor(_wrapperMessage:string, _originalException:any, _originalStack:any, _context:any)',
|
||||||
'WrappedException.context:any',
|
'WrappedException.context:any',
|
||||||
|
@ -505,27 +506,27 @@ const CORE = [
|
||||||
'provide(token:any, {useClass,useValue,useExisting,useFactory,deps,multi}:{useClass?:Type, useValue?:any, useExisting?:any, useFactory?:Function, deps?:Object[], multi?:boolean}):Provider',
|
'provide(token:any, {useClass,useValue,useExisting,useFactory,deps,multi}:{useClass?:Type, useValue?:any, useExisting?:any, useFactory?:Function, deps?:Object[], multi?:boolean}):Provider',
|
||||||
'resolveForwardRef(type:any):any',
|
'resolveForwardRef(type:any):any',
|
||||||
'setTestabilityGetter(getter:GetTestability):void',
|
'setTestabilityGetter(getter:GetTestability):void',
|
||||||
'var Attribute:AttributeFactory',
|
'var Attribute:AttributeMetadataFactory',
|
||||||
'var Component:ComponentFactory',
|
'var Component:ComponentMetadataFactory',
|
||||||
'var ContentChild:ContentChildFactory',
|
'var ContentChild:ContentChildMetadataFactory',
|
||||||
'var ContentChildren:ContentChildrenFactory',
|
'var ContentChildren:ContentChildrenMetadataFactory',
|
||||||
'var Directive:DirectiveFactory',
|
'var Directive:DirectiveMetadataFactory',
|
||||||
'var Host:HostFactory',
|
'var Host:HostMetadataFactory',
|
||||||
'var HostBinding:HostBindingFactory',
|
'var HostBinding:HostBindingMetadataFactory',
|
||||||
'var HostListener:HostListenerFactory',
|
'var HostListener:HostListenerMetadataFactory',
|
||||||
'var Inject:InjectFactory',
|
'var Inject:InjectMetadataFactory',
|
||||||
'var Injectable:InjectableFactory',
|
'var Injectable:InjectableMetadataFactory',
|
||||||
'var Input:InputFactory',
|
'var Input:InputMetadataFactory',
|
||||||
'var Optional:OptionalFactory',
|
'var Optional:OptionalMetadataFactory',
|
||||||
'var Output:OutputFactory',
|
'var Output:OutputMetadataFactory',
|
||||||
'var Pipe:PipeFactory',
|
'var Pipe:PipeMetadataFactory',
|
||||||
'var Query:QueryFactory',
|
'var Query:QueryMetadataFactory',
|
||||||
'var Self:SelfFactory',
|
'var Self:SelfMetadataFactory',
|
||||||
'var SkipSelf:SkipSelfFactory',
|
'var SkipSelf:SkipSelfMetadataFactory',
|
||||||
'var Type:any',
|
'var Type:any',
|
||||||
'var ViewChild:ViewChildFactory',
|
'var ViewChild:ViewChildMetadataFactory',
|
||||||
'var ViewChildren:ViewChildrenFactory',
|
'var ViewChildren:ViewChildrenMetadataFactory',
|
||||||
'var ViewQuery:QueryFactory',
|
'var ViewQuery:QueryMetadataFactory',
|
||||||
'var reflector:any'
|
'var reflector:any'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue