refactor(Type): merge Type and ConcreType<?> into Type<?> (#10616)
Closes #9729 BREAKING CHANGE: `Type` is now `Type<T>` which means that in most cases you have to use `Type<any>` in place of `Type`. We don't expect that any user applications use the `Type` type.
This commit is contained in:
parent
6f4ee6101c
commit
b96869afd2
|
@ -6,7 +6,7 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Type} from '@angular/core';
|
import {Provider} from '@angular/core';
|
||||||
|
|
||||||
import {CORE_DIRECTIVES} from './directives';
|
import {CORE_DIRECTIVES} from './directives';
|
||||||
|
|
||||||
|
@ -55,4 +55,4 @@ import {CORE_DIRECTIVES} from './directives';
|
||||||
*
|
*
|
||||||
* @experimental Contains forms which are experimental.
|
* @experimental Contains forms which are experimental.
|
||||||
*/
|
*/
|
||||||
export const COMMON_DIRECTIVES: Type[][] = [CORE_DIRECTIVES];
|
export const COMMON_DIRECTIVES: any[] = CORE_DIRECTIVES;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Type} from '../facade/lang';
|
import {Type} from '@angular/core';
|
||||||
|
|
||||||
import {NgClass} from './ng_class';
|
import {NgClass} from './ng_class';
|
||||||
import {NgFor} from './ng_for';
|
import {NgFor} from './ng_for';
|
||||||
|
@ -58,7 +58,7 @@ import {NgTemplateOutlet} from './ng_template_outlet';
|
||||||
*
|
*
|
||||||
* @stable
|
* @stable
|
||||||
*/
|
*/
|
||||||
export const CORE_DIRECTIVES: Type[] = [
|
export const CORE_DIRECTIVES: Type<any>[] = [
|
||||||
NgClass,
|
NgClass,
|
||||||
NgFor,
|
NgFor,
|
||||||
NgIf,
|
NgIf,
|
||||||
|
|
|
@ -57,7 +57,7 @@ export {NG_ASYNC_VALIDATORS, NG_VALIDATORS, Validators} from './forms-deprecated
|
||||||
*
|
*
|
||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
export const FORM_PROVIDERS: Type[] = [FormBuilder, RadioControlRegistry];
|
export const FORM_PROVIDERS: Type<any>[] = [FormBuilder, RadioControlRegistry];
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -58,7 +58,7 @@ export {MaxLengthValidator, MinLengthValidator, PatternValidator, RequiredValida
|
||||||
* ```
|
* ```
|
||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
export const FORM_DIRECTIVES: Type[] = [
|
export const FORM_DIRECTIVES: Type<any>[] = [
|
||||||
NgControlName,
|
NgControlName,
|
||||||
NgControlGroup,
|
NgControlGroup,
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {BaseException} from '@angular/core';
|
import {BaseException, Type} from '@angular/core';
|
||||||
import {Type, stringify} from '../facade/lang';
|
import {stringify} from '../facade/lang';
|
||||||
|
|
||||||
export class InvalidPipeArgumentException extends BaseException {
|
export class InvalidPipeArgumentException extends BaseException {
|
||||||
constructor(type: Type, value: Object) {
|
constructor(type: Type<any>, value: Object) {
|
||||||
super(`Invalid argument '${value}' for pipe '${stringify(type)}'`);
|
super(`Invalid argument '${value}' for pipe '${stringify(type)}'`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Pipe, PipeTransform} from '@angular/core';
|
import {Pipe, PipeTransform, Type} from '@angular/core';
|
||||||
|
|
||||||
import {NumberFormatStyle, NumberFormatter} from '../facade/intl';
|
import {NumberFormatStyle, NumberFormatter} from '../facade/intl';
|
||||||
import {NumberWrapper, Type, isBlank, isNumber, isPresent, isString} from '../facade/lang';
|
import {NumberWrapper, isBlank, isNumber, isPresent, isString} from '../facade/lang';
|
||||||
|
|
||||||
import {InvalidPipeArgumentException} from './invalid_pipe_argument_exception';
|
import {InvalidPipeArgumentException} from './invalid_pipe_argument_exception';
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ var defaultLocale: string = 'en-US';
|
||||||
const _NUMBER_FORMAT_REGEXP = /^(\d+)?\.((\d+)(\-(\d+))?)?$/;
|
const _NUMBER_FORMAT_REGEXP = /^(\d+)?\.((\d+)(\-(\d+))?)?$/;
|
||||||
|
|
||||||
function formatNumber(
|
function formatNumber(
|
||||||
pipe: Type, value: number | string, style: NumberFormatStyle, digits: string,
|
pipe: Type<any>, value: number | string, style: NumberFormatStyle, digits: string,
|
||||||
currency: string = null, currencyAsSymbol: boolean = false): string {
|
currency: string = null, currencyAsSymbol: boolean = false): string {
|
||||||
if (isBlank(value)) return null;
|
if (isBlank(value)) return null;
|
||||||
// Convert strings to numbers
|
// Convert strings to numbers
|
||||||
|
|
|
@ -6,13 +6,13 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {ChangeDetectionStrategy, SchemaMetadata, ViewEncapsulation} from '@angular/core';
|
import {ChangeDetectionStrategy, SchemaMetadata, Type, ViewEncapsulation} from '@angular/core';
|
||||||
|
|
||||||
import {LifecycleHooks, reflector} from '../core_private';
|
import {LifecycleHooks, reflector} from '../core_private';
|
||||||
|
|
||||||
import {ListWrapper, StringMapWrapper} from './facade/collection';
|
import {ListWrapper, StringMapWrapper} from './facade/collection';
|
||||||
import {BaseException, unimplemented} from './facade/exceptions';
|
import {BaseException, unimplemented} from './facade/exceptions';
|
||||||
import {Type, isBlank, isPresent, isStringMap, normalizeBlank, normalizeBool} from './facade/lang';
|
import {isBlank, isPresent, isStringMap, normalizeBlank, normalizeBool} from './facade/lang';
|
||||||
|
|
||||||
import {CssSelector} from './selector';
|
import {CssSelector} from './selector';
|
||||||
import {getUrlScheme} from './url_resolver';
|
import {getUrlScheme} from './url_resolver';
|
||||||
import {sanitizeIdentifier, splitAtColon} from './util';
|
import {sanitizeIdentifier, splitAtColon} from './util';
|
||||||
|
@ -308,7 +308,7 @@ export class CompileTypeMetadata extends CompileIdentifierMetadata {
|
||||||
lifecycleHooks: LifecycleHooks[];
|
lifecycleHooks: LifecycleHooks[];
|
||||||
|
|
||||||
constructor({runtime, name, moduleUrl, prefix, isHost, value, diDeps, lifecycleHooks}: {
|
constructor({runtime, name, moduleUrl, prefix, isHost, value, diDeps, lifecycleHooks}: {
|
||||||
runtime?: Type,
|
runtime?: Type<any>,
|
||||||
name?: string,
|
name?: string,
|
||||||
moduleUrl?: string,
|
moduleUrl?: string,
|
||||||
prefix?: string,
|
prefix?: string,
|
||||||
|
@ -685,8 +685,8 @@ export class CompileNgModuleMetadata implements CompileMetadataWithIdentifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class TransitiveCompileNgModuleMetadata {
|
export class TransitiveCompileNgModuleMetadata {
|
||||||
directivesSet = new Set<Type>();
|
directivesSet = new Set<Type<any>>();
|
||||||
pipesSet = new Set<Type>();
|
pipesSet = new Set<Type<any>>();
|
||||||
constructor(
|
constructor(
|
||||||
public modules: CompileNgModuleMetadata[], public providers: CompileProviderMetadata[],
|
public modules: CompileNgModuleMetadata[], public providers: CompileProviderMetadata[],
|
||||||
public entryComponents: CompileTypeMetadata[], public directives: CompileDirectiveMetadata[],
|
public entryComponents: CompileTypeMetadata[], public directives: CompileDirectiveMetadata[],
|
||||||
|
|
|
@ -52,7 +52,7 @@ const _NO_XHR: XHR = {
|
||||||
* A set of providers that provide `RuntimeCompiler` and its dependencies to use for
|
* A set of providers that provide `RuntimeCompiler` and its dependencies to use for
|
||||||
* template compilation.
|
* template compilation.
|
||||||
*/
|
*/
|
||||||
export const COMPILER_PROVIDERS: Array<any|Type|{[k: string]: any}|any[]> = [
|
export const COMPILER_PROVIDERS: Array<any|Type<any>|{[k: string]: any}|any[]> = [
|
||||||
{provide: Reflector, useValue: reflector},
|
{provide: Reflector, useValue: reflector},
|
||||||
{provide: ReflectorReader, useExisting: Reflector},
|
{provide: ReflectorReader, useExisting: Reflector},
|
||||||
{provide: XHR, useValue: _NO_XHR},
|
{provide: XHR, useValue: _NO_XHR},
|
||||||
|
@ -79,8 +79,11 @@ export const COMPILER_PROVIDERS: Array<any|Type|{[k: string]: any}|any[]> = [
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
export function analyzeAppProvidersForDeprecatedConfiguration(appProviders: any[] = []):
|
export function analyzeAppProvidersForDeprecatedConfiguration(appProviders: any[] = []): {
|
||||||
{compilerOptions: CompilerOptions, moduleDeclarations: Type[], deprecationMessages: string[]} {
|
compilerOptions: CompilerOptions,
|
||||||
|
moduleDeclarations: Type<any>[],
|
||||||
|
deprecationMessages: string[]
|
||||||
|
} {
|
||||||
let platformDirectives: any[] = [];
|
let platformDirectives: any[] = [];
|
||||||
let platformPipes: any[] = [];
|
let platformPipes: any[] = [];
|
||||||
|
|
||||||
|
|
|
@ -6,12 +6,11 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {BaseException, ComponentMetadata, DirectiveMetadata, HostBindingMetadata, HostListenerMetadata, Injectable, InputMetadata, OutputMetadata, QueryMetadata, resolveForwardRef} from '@angular/core';
|
import {ComponentMetadata, DirectiveMetadata, HostBindingMetadata, HostListenerMetadata, Injectable, InputMetadata, OutputMetadata, QueryMetadata, Type, resolveForwardRef} from '@angular/core';
|
||||||
|
|
||||||
import {ReflectorReader, reflector} from '../core_private';
|
import {ReflectorReader, reflector} from '../core_private';
|
||||||
|
|
||||||
import {StringMapWrapper} from './facade/collection';
|
import {StringMapWrapper} from './facade/collection';
|
||||||
import {Type, isPresent, stringify} from './facade/lang';
|
import {BaseException} from './facade/exceptions';
|
||||||
|
import {isPresent, stringify} from './facade/lang';
|
||||||
import {splitAtColon} from './util';
|
import {splitAtColon} from './util';
|
||||||
|
|
||||||
function _isDirectiveMetadata(type: any): type is DirectiveMetadata {
|
function _isDirectiveMetadata(type: any): type is DirectiveMetadata {
|
||||||
|
@ -32,7 +31,7 @@ export class DirectiveResolver {
|
||||||
/**
|
/**
|
||||||
* Return {@link DirectiveMetadata} for a given `Type`.
|
* Return {@link DirectiveMetadata} for a given `Type`.
|
||||||
*/
|
*/
|
||||||
resolve(type: Type, throwIfNotFound = true): DirectiveMetadata {
|
resolve(type: Type<any>, throwIfNotFound = true): DirectiveMetadata {
|
||||||
var typeMetadata = this._reflector.annotations(resolveForwardRef(type));
|
var typeMetadata = this._reflector.annotations(resolveForwardRef(type));
|
||||||
if (isPresent(typeMetadata)) {
|
if (isPresent(typeMetadata)) {
|
||||||
var metadata = typeMetadata.find(_isDirectiveMetadata);
|
var metadata = typeMetadata.find(_isDirectiveMetadata);
|
||||||
|
@ -49,7 +48,7 @@ export class DirectiveResolver {
|
||||||
|
|
||||||
private _mergeWithPropertyMetadata(
|
private _mergeWithPropertyMetadata(
|
||||||
dm: DirectiveMetadata, propertyMetadata: {[key: string]: any[]},
|
dm: DirectiveMetadata, propertyMetadata: {[key: string]: any[]},
|
||||||
directiveType: Type): DirectiveMetadata {
|
directiveType: Type<any>): DirectiveMetadata {
|
||||||
var inputs: string[] = [];
|
var inputs: string[] = [];
|
||||||
var outputs: string[] = [];
|
var outputs: string[] = [];
|
||||||
var host: {[key: string]: string} = {};
|
var host: {[key: string]: string} = {};
|
||||||
|
@ -90,7 +89,7 @@ export class DirectiveResolver {
|
||||||
|
|
||||||
private _merge(
|
private _merge(
|
||||||
dm: DirectiveMetadata, inputs: string[], outputs: string[], host: {[key: string]: string},
|
dm: DirectiveMetadata, inputs: string[], outputs: string[], host: {[key: string]: string},
|
||||||
queries: {[key: string]: any}, directiveType: Type): DirectiveMetadata {
|
queries: {[key: string]: any}, directiveType: Type<any>): DirectiveMetadata {
|
||||||
let mergedInputs: string[];
|
let mergedInputs: string[];
|
||||||
|
|
||||||
if (isPresent(dm.inputs)) {
|
if (isPresent(dm.inputs)) {
|
||||||
|
|
|
@ -6,14 +6,13 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {AfterContentChecked, AfterContentInit, AfterViewChecked, AfterViewInit, DoCheck, OnChanges, OnDestroy, OnInit} from '@angular/core';
|
import {AfterContentChecked, AfterContentInit, AfterViewChecked, AfterViewInit, DoCheck, OnChanges, OnDestroy, OnInit, Type} from '@angular/core';
|
||||||
|
|
||||||
import {LifecycleHooks, reflector} from '../core_private';
|
import {LifecycleHooks, reflector} from '../core_private';
|
||||||
|
|
||||||
import {MapWrapper} from './facade/collection';
|
import {MapWrapper} from './facade/collection';
|
||||||
import {Type} from './facade/lang';
|
|
||||||
|
|
||||||
const LIFECYCLE_INTERFACES: Map<any, Type> = MapWrapper.createFromPairs([
|
const LIFECYCLE_INTERFACES: Map<any, Type<any>> = MapWrapper.createFromPairs([
|
||||||
[LifecycleHooks.OnInit, OnInit],
|
[LifecycleHooks.OnInit, OnInit],
|
||||||
[LifecycleHooks.OnDestroy, OnDestroy],
|
[LifecycleHooks.OnDestroy, OnDestroy],
|
||||||
[LifecycleHooks.DoCheck, DoCheck],
|
[LifecycleHooks.DoCheck, DoCheck],
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {AnimationAnimateMetadata, AnimationEntryMetadata, AnimationGroupMetadata, AnimationKeyframesSequenceMetadata, AnimationMetadata, AnimationStateDeclarationMetadata, AnimationStateMetadata, AnimationStateTransitionMetadata, AnimationStyleMetadata, AnimationWithStepsMetadata, AttributeMetadata, BaseException, ChangeDetectionStrategy, ComponentMetadata, HostMetadata, Inject, InjectMetadata, Injectable, ModuleWithProviders, NgModule, NgModuleMetadata, Optional, OptionalMetadata, Provider, QueryMetadata, SchemaMetadata, SelfMetadata, SkipSelfMetadata, ViewMetadata, ViewQueryMetadata, resolveForwardRef} from '@angular/core';
|
import {AnimationAnimateMetadata, AnimationEntryMetadata, AnimationGroupMetadata, AnimationKeyframesSequenceMetadata, AnimationMetadata, AnimationStateDeclarationMetadata, AnimationStateMetadata, AnimationStateTransitionMetadata, AnimationStyleMetadata, AnimationWithStepsMetadata, AttributeMetadata, ChangeDetectionStrategy, ComponentMetadata, HostMetadata, InjectMetadata, Injectable, ModuleWithProviders, OptionalMetadata, Provider, QueryMetadata, SchemaMetadata, SelfMetadata, SkipSelfMetadata, Type, ViewQueryMetadata, resolveForwardRef} from '@angular/core';
|
||||||
|
|
||||||
import {Console, LIFECYCLE_HOOKS_VALUES, ReflectorReader, createProvider, isProviderLiteral, reflector} from '../core_private';
|
import {Console, LIFECYCLE_HOOKS_VALUES, ReflectorReader, createProvider, isProviderLiteral, reflector} from '../core_private';
|
||||||
import {StringMapWrapper} from '../src/facade/collection';
|
import {StringMapWrapper} from '../src/facade/collection';
|
||||||
|
@ -15,7 +15,8 @@ import {assertArrayOfStrings, assertInterpolationSymbols} from './assertions';
|
||||||
import * as cpl from './compile_metadata';
|
import * as cpl from './compile_metadata';
|
||||||
import {CompilerConfig} from './config';
|
import {CompilerConfig} from './config';
|
||||||
import {DirectiveResolver} from './directive_resolver';
|
import {DirectiveResolver} from './directive_resolver';
|
||||||
import {Type, isArray, isBlank, isPresent, isString, stringify} from './facade/lang';
|
import {BaseException} from './facade/exceptions';
|
||||||
|
import {isArray, isBlank, isPresent, isString, stringify} from './facade/lang';
|
||||||
import {Identifiers, identifierToken} from './identifiers';
|
import {Identifiers, identifierToken} from './identifiers';
|
||||||
import {hasLifecycleHook} from './lifecycle_reflector';
|
import {hasLifecycleHook} from './lifecycle_reflector';
|
||||||
import {NgModuleResolver} from './ng_module_resolver';
|
import {NgModuleResolver} from './ng_module_resolver';
|
||||||
|
@ -26,10 +27,10 @@ import {MODULE_SUFFIX, ValueTransformer, sanitizeIdentifier, visitValue} from '.
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class CompileMetadataResolver {
|
export class CompileMetadataResolver {
|
||||||
private _directiveCache = new Map<Type, cpl.CompileDirectiveMetadata>();
|
private _directiveCache = new Map<Type<any>, cpl.CompileDirectiveMetadata>();
|
||||||
private _pipeCache = new Map<Type, cpl.CompilePipeMetadata>();
|
private _pipeCache = new Map<Type<any>, cpl.CompilePipeMetadata>();
|
||||||
private _ngModuleCache = new Map<Type, cpl.CompileNgModuleMetadata>();
|
private _ngModuleCache = new Map<Type<any>, cpl.CompileNgModuleMetadata>();
|
||||||
private _ngModuleOfTypes = new Map<Type, Type>();
|
private _ngModuleOfTypes = new Map<Type<any>, Type<any>>();
|
||||||
private _anonymousTypes = new Map<Object, number>();
|
private _anonymousTypes = new Map<Object, number>();
|
||||||
private _anonymousTypeIndex = 0;
|
private _anonymousTypeIndex = 0;
|
||||||
|
|
||||||
|
@ -53,7 +54,7 @@ export class CompileMetadataResolver {
|
||||||
return sanitizeIdentifier(identifier);
|
return sanitizeIdentifier(identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
clearCacheFor(type: Type) {
|
clearCacheFor(type: Type<any>) {
|
||||||
this._directiveCache.delete(type);
|
this._directiveCache.delete(type);
|
||||||
this._pipeCache.delete(type);
|
this._pipeCache.delete(type);
|
||||||
this._ngModuleOfTypes.delete(type);
|
this._ngModuleOfTypes.delete(type);
|
||||||
|
@ -110,7 +111,8 @@ export class CompileMetadataResolver {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
getDirectiveMetadata(directiveType: Type, throwIfNotFound = true): cpl.CompileDirectiveMetadata {
|
getDirectiveMetadata(directiveType: Type<any>, throwIfNotFound = true):
|
||||||
|
cpl.CompileDirectiveMetadata {
|
||||||
directiveType = resolveForwardRef(directiveType);
|
directiveType = resolveForwardRef(directiveType);
|
||||||
var meta = this._directiveCache.get(directiveType);
|
var meta = this._directiveCache.get(directiveType);
|
||||||
if (isBlank(meta)) {
|
if (isBlank(meta)) {
|
||||||
|
@ -241,7 +243,7 @@ export class CompileMetadataResolver {
|
||||||
|
|
||||||
if (meta.imports) {
|
if (meta.imports) {
|
||||||
flattenArray(meta.imports).forEach((importedType) => {
|
flattenArray(meta.imports).forEach((importedType) => {
|
||||||
let importedModuleType: Type;
|
let importedModuleType: Type<any>;
|
||||||
if (isValidType(importedType)) {
|
if (isValidType(importedType)) {
|
||||||
importedModuleType = importedType;
|
importedModuleType = importedType;
|
||||||
} else if (importedType && importedType.ngModule) {
|
} else if (importedType && importedType.ngModule) {
|
||||||
|
@ -352,7 +354,7 @@ export class CompileMetadataResolver {
|
||||||
return compileMeta;
|
return compileMeta;
|
||||||
}
|
}
|
||||||
|
|
||||||
addComponentToModule(moduleType: Type, compType: Type) {
|
addComponentToModule(moduleType: Type<any>, compType: Type<any>) {
|
||||||
const moduleMeta = this.getNgModuleMetadata(moduleType);
|
const moduleMeta = this.getNgModuleMetadata(moduleType);
|
||||||
// Collect @Component.directives/pipes/entryComponents into our declared directives/pipes.
|
// Collect @Component.directives/pipes/entryComponents into our declared directives/pipes.
|
||||||
const compMeta = this.getDirectiveMetadata(compType, false);
|
const compMeta = this.getDirectiveMetadata(compType, false);
|
||||||
|
@ -395,7 +397,7 @@ export class CompileMetadataResolver {
|
||||||
(dirMeta) => { this._getTransitiveViewDirectivesAndPipes(dirMeta, moduleMeta); });
|
(dirMeta) => { this._getTransitiveViewDirectivesAndPipes(dirMeta, moduleMeta); });
|
||||||
}
|
}
|
||||||
|
|
||||||
private _addTypeToModule(type: Type, moduleType: Type) {
|
private _addTypeToModule(type: Type<any>, moduleType: Type<any>) {
|
||||||
const oldModule = this._ngModuleOfTypes.get(type);
|
const oldModule = this._ngModuleOfTypes.get(type);
|
||||||
if (oldModule && oldModule !== moduleType) {
|
if (oldModule && oldModule !== moduleType) {
|
||||||
throw new BaseException(
|
throw new BaseException(
|
||||||
|
@ -410,13 +412,13 @@ export class CompileMetadataResolver {
|
||||||
if (!compMeta.isComponent) {
|
if (!compMeta.isComponent) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const addPipe = (pipeType: Type) => {
|
const addPipe = (pipeType: Type<any>) => {
|
||||||
const pipeMeta = this.getPipeMetadata(pipeType);
|
const pipeMeta = this.getPipeMetadata(pipeType);
|
||||||
this._addPipeToModule(
|
this._addPipeToModule(
|
||||||
pipeMeta, moduleMeta.type.runtime, moduleMeta.transitiveModule, moduleMeta.declaredPipes);
|
pipeMeta, moduleMeta.type.runtime, moduleMeta.transitiveModule, moduleMeta.declaredPipes);
|
||||||
};
|
};
|
||||||
|
|
||||||
const addDirective = (dirType: Type) => {
|
const addDirective = (dirType: Type<any>) => {
|
||||||
const dirMeta = this.getDirectiveMetadata(dirType);
|
const dirMeta = this.getDirectiveMetadata(dirType);
|
||||||
if (this._addDirectiveToModule(
|
if (this._addDirectiveToModule(
|
||||||
dirMeta, moduleMeta.type.runtime, moduleMeta.transitiveModule,
|
dirMeta, moduleMeta.type.runtime, moduleMeta.transitiveModule,
|
||||||
|
@ -484,7 +486,7 @@ export class CompileMetadataResolver {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
getTypeMetadata(type: Type, moduleUrl: string, dependencies: any[] = null):
|
getTypeMetadata(type: Type<any>, moduleUrl: string, dependencies: any[] = null):
|
||||||
cpl.CompileTypeMetadata {
|
cpl.CompileTypeMetadata {
|
||||||
type = resolveForwardRef(type);
|
type = resolveForwardRef(type);
|
||||||
return new cpl.CompileTypeMetadata({
|
return new cpl.CompileTypeMetadata({
|
||||||
|
@ -507,7 +509,7 @@ export class CompileMetadataResolver {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getPipeMetadata(pipeType: Type, throwIfNotFound = true): cpl.CompilePipeMetadata {
|
getPipeMetadata(pipeType: Type<any>, throwIfNotFound = true): cpl.CompilePipeMetadata {
|
||||||
pipeType = resolveForwardRef(pipeType);
|
pipeType = resolveForwardRef(pipeType);
|
||||||
var meta = this._pipeCache.get(pipeType);
|
var meta = this._pipeCache.get(pipeType);
|
||||||
if (isBlank(meta)) {
|
if (isBlank(meta)) {
|
||||||
|
@ -525,7 +527,7 @@ export class CompileMetadataResolver {
|
||||||
return meta;
|
return meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
getDependenciesMetadata(typeOrFunc: Type|Function, dependencies: any[]):
|
getDependenciesMetadata(typeOrFunc: Type<any>|Function, dependencies: any[]):
|
||||||
cpl.CompileDiDependencyMetadata[] {
|
cpl.CompileDiDependencyMetadata[] {
|
||||||
let hasUnknownDeps = false;
|
let hasUnknownDeps = false;
|
||||||
let params = isPresent(dependencies) ? dependencies : this._reflector.parameters(typeOrFunc);
|
let params = isPresent(dependencies) ? dependencies : this._reflector.parameters(typeOrFunc);
|
||||||
|
@ -694,7 +696,7 @@ export class CompileMetadataResolver {
|
||||||
|
|
||||||
getQueriesMetadata(
|
getQueriesMetadata(
|
||||||
queries: {[key: string]: QueryMetadata}, isViewQuery: boolean,
|
queries: {[key: string]: QueryMetadata}, isViewQuery: boolean,
|
||||||
directiveType: Type): cpl.CompileQueryMetadata[] {
|
directiveType: Type<any>): cpl.CompileQueryMetadata[] {
|
||||||
var res: cpl.CompileQueryMetadata[] = [];
|
var res: cpl.CompileQueryMetadata[] = [];
|
||||||
StringMapWrapper.forEach(queries, (query: QueryMetadata, propertyName: string) => {
|
StringMapWrapper.forEach(queries, (query: QueryMetadata, propertyName: string) => {
|
||||||
if (query.isViewQuery === isViewQuery) {
|
if (query.isViewQuery === isViewQuery) {
|
||||||
|
@ -704,7 +706,7 @@ export class CompileMetadataResolver {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
getQueryMetadata(q: QueryMetadata, propertyName: string, typeOrFunc: Type|Function):
|
getQueryMetadata(q: QueryMetadata, propertyName: string, typeOrFunc: Type<any>|Function):
|
||||||
cpl.CompileQueryMetadata {
|
cpl.CompileQueryMetadata {
|
||||||
var selectors: cpl.CompileTokenMetadata[];
|
var selectors: cpl.CompileTokenMetadata[];
|
||||||
if (q.isVarBindingQuery) {
|
if (q.isVarBindingQuery) {
|
||||||
|
@ -729,7 +731,7 @@ export class CompileMetadataResolver {
|
||||||
function getTransitiveModules(
|
function getTransitiveModules(
|
||||||
modules: cpl.CompileNgModuleMetadata[], includeImports: boolean,
|
modules: cpl.CompileNgModuleMetadata[], includeImports: boolean,
|
||||||
targetModules: cpl.CompileNgModuleMetadata[] = [],
|
targetModules: cpl.CompileNgModuleMetadata[] = [],
|
||||||
visitedModules = new Set<Type>()): cpl.CompileNgModuleMetadata[] {
|
visitedModules = new Set<Type<any>>()): cpl.CompileNgModuleMetadata[] {
|
||||||
modules.forEach((ngModule) => {
|
modules.forEach((ngModule) => {
|
||||||
if (!visitedModules.has(ngModule.type.runtime)) {
|
if (!visitedModules.has(ngModule.type.runtime)) {
|
||||||
visitedModules.add(ngModule.type.runtime);
|
visitedModules.add(ngModule.type.runtime);
|
||||||
|
@ -761,7 +763,7 @@ function flattenArray(tree: any[], out: Array<any> = []): Array<any> {
|
||||||
}
|
}
|
||||||
|
|
||||||
function verifyNonBlankProviders(
|
function verifyNonBlankProviders(
|
||||||
directiveType: Type, providersTree: any[], providersType: string): any[] {
|
directiveType: Type<any>, providersTree: any[], providersType: string): any[] {
|
||||||
var flat: any[] = [];
|
var flat: any[] = [];
|
||||||
var errMsg: string;
|
var errMsg: string;
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {BaseException, Injectable, NgModuleMetadata} from '@angular/core';
|
import {Injectable, NgModuleMetadata, Type} from '@angular/core';
|
||||||
|
|
||||||
import {ReflectorReader, reflector} from '../core_private';
|
import {ReflectorReader, reflector} from '../core_private';
|
||||||
|
import {BaseException} from '../src/facade/exceptions';
|
||||||
import {Type, isPresent, stringify} from './facade/lang';
|
import {isPresent, stringify} from './facade/lang';
|
||||||
|
|
||||||
function _isNgModuleMetadata(obj: any): obj is NgModuleMetadata {
|
function _isNgModuleMetadata(obj: any): obj is NgModuleMetadata {
|
||||||
return obj instanceof NgModuleMetadata;
|
return obj instanceof NgModuleMetadata;
|
||||||
|
@ -23,7 +23,7 @@ function _isNgModuleMetadata(obj: any): obj is NgModuleMetadata {
|
||||||
export class NgModuleResolver {
|
export class NgModuleResolver {
|
||||||
constructor(private _reflector: ReflectorReader = reflector) {}
|
constructor(private _reflector: ReflectorReader = reflector) {}
|
||||||
|
|
||||||
resolve(type: Type, throwIfNotFound = true): NgModuleMetadata {
|
resolve(type: Type<any>, throwIfNotFound = true): NgModuleMetadata {
|
||||||
const ngModuleMeta: NgModuleMetadata =
|
const ngModuleMeta: NgModuleMetadata =
|
||||||
this._reflector.annotations(type).find(_isNgModuleMetadata);
|
this._reflector.annotations(type).find(_isNgModuleMetadata);
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,12 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {BaseException, Injectable, PipeMetadata, resolveForwardRef} from '@angular/core';
|
import {Injectable, PipeMetadata, Type, resolveForwardRef} from '@angular/core';
|
||||||
|
|
||||||
import {ReflectorReader, reflector} from '../core_private';
|
import {ReflectorReader, reflector} from '../core_private';
|
||||||
|
|
||||||
import {Type, isPresent, stringify} from './facade/lang';
|
import {BaseException} from './facade/exceptions';
|
||||||
|
import {isPresent, stringify} from './facade/lang';
|
||||||
|
|
||||||
function _isPipeMetadata(type: any): boolean {
|
function _isPipeMetadata(type: any): boolean {
|
||||||
return type instanceof PipeMetadata;
|
return type instanceof PipeMetadata;
|
||||||
|
@ -30,7 +31,7 @@ export class PipeResolver {
|
||||||
/**
|
/**
|
||||||
* Return {@link PipeMetadata} for a given `Type`.
|
* Return {@link PipeMetadata} for a given `Type`.
|
||||||
*/
|
*/
|
||||||
resolve(type: Type, throwIfNotFound = true): PipeMetadata {
|
resolve(type: Type<any>, throwIfNotFound = true): PipeMetadata {
|
||||||
var metas = this._reflector.annotations(resolveForwardRef(type));
|
var metas = this._reflector.annotations(resolveForwardRef(type));
|
||||||
if (isPresent(metas)) {
|
if (isPresent(metas)) {
|
||||||
var annotation = metas.find(_isPipeMetadata);
|
var annotation = metas.find(_isPipeMetadata);
|
||||||
|
|
|
@ -6,14 +6,15 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {BaseException, Compiler, ComponentFactory, ComponentResolver, ComponentStillLoadingError, Injectable, Injector, ModuleWithComponentFactories, NgModule, NgModuleFactory, NgModuleMetadata, OptionalMetadata, Provider, SchemaMetadata, SkipSelfMetadata} from '@angular/core';
|
import {Compiler, ComponentFactory, ComponentResolver, ComponentStillLoadingError, Injectable, Injector, ModuleWithComponentFactories, NgModuleFactory, OptionalMetadata, Provider, SchemaMetadata, SkipSelfMetadata, Type} from '@angular/core';
|
||||||
|
|
||||||
import {Console} from '../core_private';
|
import {Console} from '../core_private';
|
||||||
|
|
||||||
import {CompileDirectiveMetadata, CompileIdentifierMetadata, CompileNgModuleMetadata, CompilePipeMetadata, createHostComponentMeta} from './compile_metadata';
|
import {CompileDirectiveMetadata, CompileIdentifierMetadata, CompileNgModuleMetadata, CompilePipeMetadata, createHostComponentMeta} from './compile_metadata';
|
||||||
import {CompilerConfig} from './config';
|
import {CompilerConfig} from './config';
|
||||||
import {DirectiveNormalizer} from './directive_normalizer';
|
import {DirectiveNormalizer} from './directive_normalizer';
|
||||||
import {ConcreteType, Type, isBlank, isString, stringify} from './facade/lang';
|
import {BaseException} from './facade/exceptions';
|
||||||
|
import {isBlank, isString, stringify} from './facade/lang';
|
||||||
import {CompileMetadataResolver} from './metadata_resolver';
|
import {CompileMetadataResolver} from './metadata_resolver';
|
||||||
import {NgModuleCompiler} from './ng_module_compiler';
|
import {NgModuleCompiler} from './ng_module_compiler';
|
||||||
import * as ir from './output/output_ast';
|
import * as ir from './output/output_ast';
|
||||||
|
@ -37,9 +38,9 @@ import {ComponentFactoryDependency, ViewCompiler, ViewFactoryDependency} from '.
|
||||||
*/
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class RuntimeCompiler implements Compiler {
|
export class RuntimeCompiler implements Compiler {
|
||||||
private _compiledTemplateCache = new Map<Type, CompiledTemplate>();
|
private _compiledTemplateCache = new Map<Type<any>, CompiledTemplate>();
|
||||||
private _compiledHostTemplateCache = new Map<Type, CompiledTemplate>();
|
private _compiledHostTemplateCache = new Map<Type<any>, CompiledTemplate>();
|
||||||
private _compiledNgModuleCache = new Map<Type, NgModuleFactory<any>>();
|
private _compiledNgModuleCache = new Map<Type<any>, NgModuleFactory<any>>();
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private _injector: Injector, private _metadataResolver: CompileMetadataResolver,
|
private _injector: Injector, private _metadataResolver: CompileMetadataResolver,
|
||||||
|
@ -50,25 +51,24 @@ export class RuntimeCompiler implements Compiler {
|
||||||
|
|
||||||
get injector(): Injector { return this._injector; }
|
get injector(): Injector { return this._injector; }
|
||||||
|
|
||||||
compileModuleSync<T>(moduleType: ConcreteType<T>): NgModuleFactory<T> {
|
compileModuleSync<T>(moduleType: Type<T>): NgModuleFactory<T> {
|
||||||
return this._compileModuleAndComponents(moduleType, true).syncResult;
|
return this._compileModuleAndComponents(moduleType, true).syncResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
compileModuleAsync<T>(moduleType: ConcreteType<T>): Promise<NgModuleFactory<T>> {
|
compileModuleAsync<T>(moduleType: Type<T>): Promise<NgModuleFactory<T>> {
|
||||||
return this._compileModuleAndComponents(moduleType, false).asyncResult;
|
return this._compileModuleAndComponents(moduleType, false).asyncResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
compileModuleAndAllComponentsSync<T>(moduleType: ConcreteType<T>):
|
compileModuleAndAllComponentsSync<T>(moduleType: Type<T>): ModuleWithComponentFactories<T> {
|
||||||
ModuleWithComponentFactories<T> {
|
|
||||||
return this._compileModuleAndAllComponents(moduleType, true).syncResult;
|
return this._compileModuleAndAllComponents(moduleType, true).syncResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
compileModuleAndAllComponentsAsync<T>(moduleType: ConcreteType<T>):
|
compileModuleAndAllComponentsAsync<T>(moduleType: Type<T>):
|
||||||
Promise<ModuleWithComponentFactories<T>> {
|
Promise<ModuleWithComponentFactories<T>> {
|
||||||
return this._compileModuleAndAllComponents(moduleType, false).asyncResult;
|
return this._compileModuleAndAllComponents(moduleType, false).asyncResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
compileComponentAsync<T>(compType: ConcreteType<T>, ngModule: ConcreteType<any> = null):
|
compileComponentAsync<T>(compType: Type<T>, ngModule: Type<any> = null):
|
||||||
Promise<ComponentFactory<T>> {
|
Promise<ComponentFactory<T>> {
|
||||||
if (!ngModule) {
|
if (!ngModule) {
|
||||||
throw new BaseException(
|
throw new BaseException(
|
||||||
|
@ -77,8 +77,7 @@ export class RuntimeCompiler implements Compiler {
|
||||||
return this._compileComponentInModule(compType, false, ngModule).asyncResult;
|
return this._compileComponentInModule(compType, false, ngModule).asyncResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
compileComponentSync<T>(compType: ConcreteType<T>, ngModule: ConcreteType<any> = null):
|
compileComponentSync<T>(compType: Type<T>, ngModule: Type<any> = null): ComponentFactory<T> {
|
||||||
ComponentFactory<T> {
|
|
||||||
if (!ngModule) {
|
if (!ngModule) {
|
||||||
throw new BaseException(
|
throw new BaseException(
|
||||||
`Calling compileComponentSync on the root compiler without a module is not allowed! (Compiling component ${stringify(compType)})`);
|
`Calling compileComponentSync on the root compiler without a module is not allowed! (Compiling component ${stringify(compType)})`);
|
||||||
|
@ -86,14 +85,14 @@ export class RuntimeCompiler implements Compiler {
|
||||||
return this._compileComponentInModule(compType, true, ngModule).syncResult;
|
return this._compileComponentInModule(compType, true, ngModule).syncResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _compileModuleAndComponents<T>(moduleType: ConcreteType<T>, isSync: boolean):
|
private _compileModuleAndComponents<T>(moduleType: Type<T>, isSync: boolean):
|
||||||
SyncAsyncResult<NgModuleFactory<T>> {
|
SyncAsyncResult<NgModuleFactory<T>> {
|
||||||
const componentPromise = this._compileComponents(moduleType, isSync);
|
const componentPromise = this._compileComponents(moduleType, isSync);
|
||||||
const ngModuleFactory = this._compileModule(moduleType);
|
const ngModuleFactory = this._compileModule(moduleType);
|
||||||
return new SyncAsyncResult(ngModuleFactory, componentPromise.then(() => ngModuleFactory));
|
return new SyncAsyncResult(ngModuleFactory, componentPromise.then(() => ngModuleFactory));
|
||||||
}
|
}
|
||||||
|
|
||||||
private _compileModuleAndAllComponents<T>(moduleType: ConcreteType<T>, isSync: boolean):
|
private _compileModuleAndAllComponents<T>(moduleType: Type<T>, isSync: boolean):
|
||||||
SyncAsyncResult<ModuleWithComponentFactories<T>> {
|
SyncAsyncResult<ModuleWithComponentFactories<T>> {
|
||||||
const componentPromise = this._compileComponents(moduleType, isSync);
|
const componentPromise = this._compileComponents(moduleType, isSync);
|
||||||
const ngModuleFactory = this._compileModule(moduleType);
|
const ngModuleFactory = this._compileModule(moduleType);
|
||||||
|
@ -121,7 +120,7 @@ export class RuntimeCompiler implements Compiler {
|
||||||
return new SyncAsyncResult(syncResult, asyncResult);
|
return new SyncAsyncResult(syncResult, asyncResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _compileModule<T>(moduleType: ConcreteType<T>): NgModuleFactory<T> {
|
private _compileModule<T>(moduleType: Type<T>): NgModuleFactory<T> {
|
||||||
let ngModuleFactory = this._compiledNgModuleCache.get(moduleType);
|
let ngModuleFactory = this._compiledNgModuleCache.get(moduleType);
|
||||||
if (!ngModuleFactory) {
|
if (!ngModuleFactory) {
|
||||||
const moduleMeta = this._metadataResolver.getNgModuleMetadata(moduleType);
|
const moduleMeta = this._metadataResolver.getNgModuleMetadata(moduleType);
|
||||||
|
@ -156,9 +155,8 @@ export class RuntimeCompiler implements Compiler {
|
||||||
return ngModuleFactory;
|
return ngModuleFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _compileComponentInModule<T>(
|
private _compileComponentInModule<T>(compType: Type<T>, isSync: boolean, moduleType: Type<any>):
|
||||||
compType: ConcreteType<T>, isSync: boolean,
|
SyncAsyncResult<ComponentFactory<T>> {
|
||||||
moduleType: ConcreteType<any>): SyncAsyncResult<ComponentFactory<T>> {
|
|
||||||
this._metadataResolver.addComponentToModule(moduleType, compType);
|
this._metadataResolver.addComponentToModule(moduleType, compType);
|
||||||
|
|
||||||
const componentPromise = this._compileComponents(moduleType, isSync);
|
const componentPromise = this._compileComponents(moduleType, isSync);
|
||||||
|
@ -171,7 +169,7 @@ export class RuntimeCompiler implements Compiler {
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
_compileComponents(mainModule: Type, isSync: boolean): Promise<any> {
|
_compileComponents(mainModule: Type<any>, isSync: boolean): Promise<any> {
|
||||||
const templates = new Set<CompiledTemplate>();
|
const templates = new Set<CompiledTemplate>();
|
||||||
var loadingPromises: Promise<any>[] = [];
|
var loadingPromises: Promise<any>[] = [];
|
||||||
|
|
||||||
|
@ -208,7 +206,7 @@ export class RuntimeCompiler implements Compiler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
clearCacheFor(type: Type) {
|
clearCacheFor(type: Type<any>) {
|
||||||
this._compiledNgModuleCache.delete(type);
|
this._compiledNgModuleCache.delete(type);
|
||||||
this._metadataResolver.clearCacheFor(type);
|
this._metadataResolver.clearCacheFor(type);
|
||||||
this._compiledHostTemplateCache.delete(type);
|
this._compiledHostTemplateCache.delete(type);
|
||||||
|
@ -227,7 +225,7 @@ export class RuntimeCompiler implements Compiler {
|
||||||
this._compiledNgModuleCache.clear();
|
this._compiledNgModuleCache.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
private _createCompiledHostTemplate(compType: Type): CompiledTemplate {
|
private _createCompiledHostTemplate(compType: Type<any>): CompiledTemplate {
|
||||||
var compiledTemplate = this._compiledHostTemplateCache.get(compType);
|
var compiledTemplate = this._compiledHostTemplateCache.get(compType);
|
||||||
if (isBlank(compiledTemplate)) {
|
if (isBlank(compiledTemplate)) {
|
||||||
var compMeta = this._metadataResolver.getDirectiveMetadata(compType);
|
var compMeta = this._metadataResolver.getDirectiveMetadata(compType);
|
||||||
|
@ -350,7 +348,7 @@ class CompiledTemplate {
|
||||||
private _normalizedCompMeta: CompileDirectiveMetadata = null;
|
private _normalizedCompMeta: CompileDirectiveMetadata = null;
|
||||||
isCompiled = false;
|
isCompiled = false;
|
||||||
isCompiledWithDeps = false;
|
isCompiledWithDeps = false;
|
||||||
viewComponentTypes: Type[] = [];
|
viewComponentTypes: Type<any>[] = [];
|
||||||
viewDirectives: CompileDirectiveMetadata[] = [];
|
viewDirectives: CompileDirectiveMetadata[] = [];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -414,12 +412,12 @@ class ModuleBoundCompiler implements Compiler, ComponentResolver {
|
||||||
private _warnOnComponentResolver = true;
|
private _warnOnComponentResolver = true;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private _delegate: RuntimeCompiler, private _ngModule: ConcreteType<any>,
|
private _delegate: RuntimeCompiler, private _ngModule: Type<any>,
|
||||||
private _parentComponentResolver: ComponentResolver, private _console: Console) {}
|
private _parentComponentResolver: ComponentResolver, private _console: Console) {}
|
||||||
|
|
||||||
get _injector(): Injector { return this._delegate.injector; }
|
get _injector(): Injector { return this._delegate.injector; }
|
||||||
|
|
||||||
resolveComponent(component: Type|string): Promise<ComponentFactory<any>> {
|
resolveComponent(component: Type<any>|string): Promise<ComponentFactory<any>> {
|
||||||
if (isString(component)) {
|
if (isString(component)) {
|
||||||
if (this._parentComponentResolver) {
|
if (this._parentComponentResolver) {
|
||||||
return this._parentComponentResolver.resolveComponent(component);
|
return this._parentComponentResolver.resolveComponent(component);
|
||||||
|
@ -432,32 +430,30 @@ class ModuleBoundCompiler implements Compiler, ComponentResolver {
|
||||||
this._console.warn(ComponentResolver.DynamicCompilationDeprecationMsg);
|
this._console.warn(ComponentResolver.DynamicCompilationDeprecationMsg);
|
||||||
this._warnOnComponentResolver = false;
|
this._warnOnComponentResolver = false;
|
||||||
}
|
}
|
||||||
return this.compileComponentAsync(<ConcreteType<any>>component);
|
return this.compileComponentAsync(<Type<any>>component);
|
||||||
}
|
}
|
||||||
|
|
||||||
compileComponentAsync<T>(compType: ConcreteType<T>, ngModule: ConcreteType<any> = null):
|
compileComponentAsync<T>(compType: Type<T>, ngModule: Type<any> = null):
|
||||||
Promise<ComponentFactory<T>> {
|
Promise<ComponentFactory<T>> {
|
||||||
return this._delegate.compileComponentAsync(compType, ngModule ? ngModule : this._ngModule);
|
return this._delegate.compileComponentAsync(compType, ngModule ? ngModule : this._ngModule);
|
||||||
}
|
}
|
||||||
|
|
||||||
compileComponentSync<T>(compType: ConcreteType<T>, ngModule: ConcreteType<any> = null):
|
compileComponentSync<T>(compType: Type<T>, ngModule: Type<any> = null): ComponentFactory<T> {
|
||||||
ComponentFactory<T> {
|
|
||||||
return this._delegate.compileComponentSync(compType, ngModule ? ngModule : this._ngModule);
|
return this._delegate.compileComponentSync(compType, ngModule ? ngModule : this._ngModule);
|
||||||
}
|
}
|
||||||
|
|
||||||
compileModuleSync<T>(moduleType: ConcreteType<T>): NgModuleFactory<T> {
|
compileModuleSync<T>(moduleType: Type<T>): NgModuleFactory<T> {
|
||||||
return this._delegate.compileModuleSync(moduleType);
|
return this._delegate.compileModuleSync(moduleType);
|
||||||
}
|
}
|
||||||
|
|
||||||
compileModuleAsync<T>(moduleType: ConcreteType<T>): Promise<NgModuleFactory<T>> {
|
compileModuleAsync<T>(moduleType: Type<T>): Promise<NgModuleFactory<T>> {
|
||||||
return this._delegate.compileModuleAsync(moduleType);
|
return this._delegate.compileModuleAsync(moduleType);
|
||||||
}
|
}
|
||||||
compileModuleAndAllComponentsSync<T>(moduleType: ConcreteType<T>):
|
compileModuleAndAllComponentsSync<T>(moduleType: Type<T>): ModuleWithComponentFactories<T> {
|
||||||
ModuleWithComponentFactories<T> {
|
|
||||||
return this._delegate.compileModuleAndAllComponentsSync(moduleType);
|
return this._delegate.compileModuleAndAllComponentsSync(moduleType);
|
||||||
}
|
}
|
||||||
|
|
||||||
compileModuleAndAllComponentsAsync<T>(moduleType: ConcreteType<T>):
|
compileModuleAndAllComponentsAsync<T>(moduleType: Type<T>):
|
||||||
Promise<ModuleWithComponentFactories<T>> {
|
Promise<ModuleWithComponentFactories<T>> {
|
||||||
return this._delegate.compileModuleAndAllComponentsAsync(moduleType);
|
return this._delegate.compileModuleAndAllComponentsAsync(moduleType);
|
||||||
}
|
}
|
||||||
|
@ -475,5 +471,5 @@ class ModuleBoundCompiler implements Compiler, ComponentResolver {
|
||||||
/**
|
/**
|
||||||
* Clears the cache for the given component/ngModule.
|
* Clears the cache for the given component/ngModule.
|
||||||
*/
|
*/
|
||||||
clearCacheFor(type: Type) { this._delegate.clearCacheFor(type); }
|
clearCacheFor(type: Type<any>) { this._delegate.clearCacheFor(type); }
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,12 +8,12 @@
|
||||||
|
|
||||||
import {DirectiveResolver, XHR} from '@angular/compiler';
|
import {DirectiveResolver, XHR} from '@angular/compiler';
|
||||||
import {MockDirectiveResolver} from '@angular/compiler/testing';
|
import {MockDirectiveResolver} from '@angular/compiler/testing';
|
||||||
import {Compiler, Component, ComponentFactory, Injectable, Injector, Input, NgModule, NgModuleFactory, ViewMetadata} from '@angular/core';
|
import {Compiler, Component, ComponentFactory, Injectable, Injector, Input, NgModule, NgModuleFactory, Type, ViewMetadata} from '@angular/core';
|
||||||
import {ComponentFixture, TestBed, TestComponentBuilder, fakeAsync, tick} from '@angular/core/testing';
|
import {ComponentFixture, TestBed, TestComponentBuilder, fakeAsync, tick} from '@angular/core/testing';
|
||||||
import {beforeEach, beforeEachProviders, ddescribe, describe, iit, inject, it, xdescribe, xit} from '@angular/core/testing/testing_internal';
|
import {beforeEach, beforeEachProviders, ddescribe, describe, iit, inject, it, xdescribe, xit} from '@angular/core/testing/testing_internal';
|
||||||
import {expect} from '@angular/platform-browser/testing/matchers';
|
import {expect} from '@angular/platform-browser/testing/matchers';
|
||||||
|
|
||||||
import {ConcreteType, stringify} from '../src/facade/lang';
|
import {stringify} from '../src/facade/lang';
|
||||||
|
|
||||||
import {SpyXHR} from './spies';
|
import {SpyXHR} from './spies';
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,7 @@ export * from './testing/directive_resolver_mock';
|
||||||
export * from './testing/ng_module_resolver_mock';
|
export * from './testing/ng_module_resolver_mock';
|
||||||
export * from './testing/pipe_resolver_mock';
|
export * from './testing/pipe_resolver_mock';
|
||||||
|
|
||||||
import {ConcreteType, Type} from './src/facade/lang';
|
import {createPlatformFactory, ModuleWithComponentFactories, Injectable, CompilerOptions, COMPILER_OPTIONS, CompilerFactory, ComponentFactory, NgModuleFactory, Injector, NgModuleMetadata, NgModuleMetadataType, ComponentMetadata, ComponentMetadataType, DirectiveMetadata, DirectiveMetadataType, PipeMetadata, PipeMetadataType, Type, PlatformRef} from '@angular/core';
|
||||||
import {createPlatformFactory, ModuleWithComponentFactories, Injectable, CompilerOptions, COMPILER_OPTIONS, PlatformRef, CompilerFactory, ComponentFactory, NgModuleFactory, Injector, NgModuleMetadata, NgModuleMetadataType, ComponentMetadata, ComponentMetadataType, DirectiveMetadata, DirectiveMetadataType, PipeMetadata, PipeMetadataType} from '@angular/core';
|
|
||||||
import {MetadataOverride} from '@angular/core/testing';
|
import {MetadataOverride} from '@angular/core/testing';
|
||||||
import {TestingCompilerFactory, TestingCompiler} from './core_private_testing';
|
import {TestingCompilerFactory, TestingCompiler} from './core_private_testing';
|
||||||
import {platformCoreDynamic, RuntimeCompiler, DirectiveResolver, NgModuleResolver, PipeResolver} from './index';
|
import {platformCoreDynamic, RuntimeCompiler, DirectiveResolver, NgModuleResolver, PipeResolver} from './index';
|
||||||
|
@ -40,55 +39,51 @@ export class TestingCompilerImpl implements TestingCompiler {
|
||||||
private _compiler: RuntimeCompiler, private _directiveResolver: MockDirectiveResolver,
|
private _compiler: RuntimeCompiler, private _directiveResolver: MockDirectiveResolver,
|
||||||
private _pipeResolver: MockPipeResolver, private _moduleResolver: MockNgModuleResolver) {}
|
private _pipeResolver: MockPipeResolver, private _moduleResolver: MockNgModuleResolver) {}
|
||||||
get injector(): Injector { return this._compiler.injector; }
|
get injector(): Injector { return this._compiler.injector; }
|
||||||
compileComponentAsync<T>(component: ConcreteType<T>, ngModule: Type = null):
|
compileComponentAsync<T>(component: Type<T>, ngModule: Type<any> = null):
|
||||||
Promise<ComponentFactory<T>> {
|
Promise<ComponentFactory<T>> {
|
||||||
return this._compiler.compileComponentAsync(component, <any>ngModule);
|
return this._compiler.compileComponentAsync(component, <any>ngModule);
|
||||||
}
|
}
|
||||||
compileComponentSync<T>(component: ConcreteType<T>, ngModule: Type = null): ComponentFactory<T> {
|
compileComponentSync<T>(component: Type<T>, ngModule: Type<any> = null): ComponentFactory<T> {
|
||||||
return this._compiler.compileComponentSync(component, <any>ngModule);
|
return this._compiler.compileComponentSync(component, <any>ngModule);
|
||||||
}
|
}
|
||||||
compileModuleSync<T>(moduleType: ConcreteType<T>): NgModuleFactory<T> {
|
compileModuleSync<T>(moduleType: Type<T>): NgModuleFactory<T> {
|
||||||
return this._compiler.compileModuleSync(moduleType);
|
return this._compiler.compileModuleSync(moduleType);
|
||||||
}
|
}
|
||||||
|
|
||||||
compileModuleAsync<T>(moduleType: ConcreteType<T>): Promise<NgModuleFactory<T>> {
|
compileModuleAsync<T>(moduleType: Type<T>): Promise<NgModuleFactory<T>> {
|
||||||
return this._compiler.compileModuleAsync(moduleType);
|
return this._compiler.compileModuleAsync(moduleType);
|
||||||
}
|
}
|
||||||
compileModuleAndAllComponentsSync<T>(moduleType: ConcreteType<T>):
|
compileModuleAndAllComponentsSync<T>(moduleType: Type<T>): ModuleWithComponentFactories<T> {
|
||||||
ModuleWithComponentFactories<T> {
|
|
||||||
return this._compiler.compileModuleAndAllComponentsSync(moduleType);
|
return this._compiler.compileModuleAndAllComponentsSync(moduleType);
|
||||||
}
|
}
|
||||||
|
|
||||||
compileModuleAndAllComponentsAsync<T>(moduleType: ConcreteType<T>):
|
compileModuleAndAllComponentsAsync<T>(moduleType: Type<T>):
|
||||||
Promise<ModuleWithComponentFactories<T>> {
|
Promise<ModuleWithComponentFactories<T>> {
|
||||||
return this._compiler.compileModuleAndAllComponentsAsync(moduleType);
|
return this._compiler.compileModuleAndAllComponentsAsync(moduleType);
|
||||||
}
|
}
|
||||||
|
|
||||||
overrideModule(ngModule: ConcreteType<any>, override: MetadataOverride<NgModuleMetadataType>):
|
overrideModule(ngModule: Type<any>, override: MetadataOverride<NgModuleMetadataType>): void {
|
||||||
void {
|
|
||||||
const oldMetadata = this._moduleResolver.resolve(ngModule, false);
|
const oldMetadata = this._moduleResolver.resolve(ngModule, false);
|
||||||
this._moduleResolver.setNgModule(
|
this._moduleResolver.setNgModule(
|
||||||
ngModule, this._overrider.overrideMetadata(NgModuleMetadata, oldMetadata, override));
|
ngModule, this._overrider.overrideMetadata(NgModuleMetadata, oldMetadata, override));
|
||||||
}
|
}
|
||||||
overrideDirective(
|
overrideDirective(directive: Type<any>, override: MetadataOverride<DirectiveMetadataType>): void {
|
||||||
directive: ConcreteType<any>, override: MetadataOverride<DirectiveMetadataType>): void {
|
|
||||||
const oldMetadata = this._directiveResolver.resolve(directive, false);
|
const oldMetadata = this._directiveResolver.resolve(directive, false);
|
||||||
this._directiveResolver.setDirective(
|
this._directiveResolver.setDirective(
|
||||||
directive, this._overrider.overrideMetadata(DirectiveMetadata, oldMetadata, override));
|
directive, this._overrider.overrideMetadata(DirectiveMetadata, oldMetadata, override));
|
||||||
}
|
}
|
||||||
overrideComponent(
|
overrideComponent(component: Type<any>, override: MetadataOverride<ComponentMetadataType>): void {
|
||||||
component: ConcreteType<any>, override: MetadataOverride<ComponentMetadataType>): void {
|
|
||||||
const oldMetadata = this._directiveResolver.resolve(component, false);
|
const oldMetadata = this._directiveResolver.resolve(component, false);
|
||||||
this._directiveResolver.setDirective(
|
this._directiveResolver.setDirective(
|
||||||
component, this._overrider.overrideMetadata(ComponentMetadata, oldMetadata, override));
|
component, this._overrider.overrideMetadata(ComponentMetadata, oldMetadata, override));
|
||||||
}
|
}
|
||||||
overridePipe(pipe: ConcreteType<any>, override: MetadataOverride<PipeMetadataType>): void {
|
overridePipe(pipe: Type<any>, override: MetadataOverride<PipeMetadataType>): void {
|
||||||
const oldMetadata = this._pipeResolver.resolve(pipe, false);
|
const oldMetadata = this._pipeResolver.resolve(pipe, false);
|
||||||
this._pipeResolver.setPipe(
|
this._pipeResolver.setPipe(
|
||||||
pipe, this._overrider.overrideMetadata(PipeMetadata, oldMetadata, override));
|
pipe, this._overrider.overrideMetadata(PipeMetadata, oldMetadata, override));
|
||||||
}
|
}
|
||||||
clearCache(): void { this._compiler.clearCache(); }
|
clearCache(): void { this._compiler.clearCache(); }
|
||||||
clearCacheFor(type: Type) { this._compiler.clearCacheFor(type); }
|
clearCacheFor(type: Type<any>) { this._compiler.clearCacheFor(type); }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -96,7 +91,7 @@ export class TestingCompilerImpl implements TestingCompiler {
|
||||||
*
|
*
|
||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
export const platformCoreDynamicTesting =
|
export const platformCoreDynamicTesting: (extraProviders?: any[]) => PlatformRef =
|
||||||
createPlatformFactory(platformCoreDynamic, 'coreDynamicTesting', [
|
createPlatformFactory(platformCoreDynamic, 'coreDynamicTesting', [
|
||||||
{
|
{
|
||||||
provide: COMPILER_OPTIONS,
|
provide: COMPILER_OPTIONS,
|
||||||
|
|
|
@ -6,11 +6,12 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {AnimationEntryMetadata, BaseException, Compiler, ComponentMetadata, DirectiveMetadata, Injectable, Injector, ViewMetadata, resolveForwardRef} from '@angular/core';
|
import {AnimationEntryMetadata, Compiler, ComponentMetadata, DirectiveMetadata, Injectable, Injector, Type, ViewMetadata, resolveForwardRef} from '@angular/core';
|
||||||
|
|
||||||
import {DirectiveResolver} from '../src/directive_resolver';
|
import {DirectiveResolver} from '../src/directive_resolver';
|
||||||
import {Map} from '../src/facade/collection';
|
import {Map} from '../src/facade/collection';
|
||||||
import {Type, isArray, isPresent, stringify} from '../src/facade/lang';
|
import {BaseException} from '../src/facade/exceptions';
|
||||||
|
import {isArray, isPresent, stringify} from '../src/facade/lang';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,21 +21,21 @@ import {Type, isArray, isPresent, stringify} from '../src/facade/lang';
|
||||||
*/
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class MockDirectiveResolver extends DirectiveResolver {
|
export class MockDirectiveResolver extends DirectiveResolver {
|
||||||
private _directives = new Map<Type, DirectiveMetadata>();
|
private _directives = new Map<Type<any>, DirectiveMetadata>();
|
||||||
private _providerOverrides = new Map<Type, any[]>();
|
private _providerOverrides = new Map<Type<any>, any[]>();
|
||||||
private _viewProviderOverrides = new Map<Type, any[]>();
|
private _viewProviderOverrides = new Map<Type<any>, any[]>();
|
||||||
private _views = new Map<Type, ViewMetadata>();
|
private _views = new Map<Type<any>, ViewMetadata>();
|
||||||
private _inlineTemplates = new Map<Type, string>();
|
private _inlineTemplates = new Map<Type<any>, string>();
|
||||||
private _animations = new Map<Type, AnimationEntryMetadata[]>();
|
private _animations = new Map<Type<any>, AnimationEntryMetadata[]>();
|
||||||
private _directiveOverrides = new Map<Type, Map<Type, Type>>();
|
private _directiveOverrides = new Map<Type<any>, Map<Type<any>, Type<any>>>();
|
||||||
|
|
||||||
constructor(private _injector: Injector) { super(); }
|
constructor(private _injector: Injector) { super(); }
|
||||||
|
|
||||||
private get _compiler(): Compiler { return this._injector.get(Compiler); }
|
private get _compiler(): Compiler { return this._injector.get(Compiler); }
|
||||||
|
|
||||||
private _clearCacheFor(component: Type) { this._compiler.clearCacheFor(component); }
|
private _clearCacheFor(component: Type<any>) { this._compiler.clearCacheFor(component); }
|
||||||
|
|
||||||
resolve(type: Type, throwIfNotFound = true): DirectiveMetadata {
|
resolve(type: Type<any>, throwIfNotFound = true): DirectiveMetadata {
|
||||||
let metadata = this._directives.get(type);
|
let metadata = this._directives.get(type);
|
||||||
if (!metadata) {
|
if (!metadata) {
|
||||||
metadata = super.resolve(type, throwIfNotFound);
|
metadata = super.resolve(type, throwIfNotFound);
|
||||||
|
@ -134,17 +135,17 @@ export class MockDirectiveResolver extends DirectiveResolver {
|
||||||
/**
|
/**
|
||||||
* Overrides the {@link DirectiveMetadata} for a directive.
|
* Overrides the {@link DirectiveMetadata} for a directive.
|
||||||
*/
|
*/
|
||||||
setDirective(type: Type, metadata: DirectiveMetadata): void {
|
setDirective(type: Type<any>, metadata: DirectiveMetadata): void {
|
||||||
this._directives.set(type, metadata);
|
this._directives.set(type, metadata);
|
||||||
this._clearCacheFor(type);
|
this._clearCacheFor(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
setProvidersOverride(type: Type, providers: any[]): void {
|
setProvidersOverride(type: Type<any>, providers: any[]): void {
|
||||||
this._providerOverrides.set(type, providers);
|
this._providerOverrides.set(type, providers);
|
||||||
this._clearCacheFor(type);
|
this._clearCacheFor(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
setViewProvidersOverride(type: Type, viewProviders: any[]): void {
|
setViewProvidersOverride(type: Type<any>, viewProviders: any[]): void {
|
||||||
this._viewProviderOverrides.set(type, viewProviders);
|
this._viewProviderOverrides.set(type, viewProviders);
|
||||||
this._clearCacheFor(type);
|
this._clearCacheFor(type);
|
||||||
}
|
}
|
||||||
|
@ -152,19 +153,19 @@ export class MockDirectiveResolver extends DirectiveResolver {
|
||||||
/**
|
/**
|
||||||
* Overrides the {@link ViewMetadata} for a component.
|
* Overrides the {@link ViewMetadata} for a component.
|
||||||
*/
|
*/
|
||||||
setView(component: Type, view: ViewMetadata): void {
|
setView(component: Type<any>, view: ViewMetadata): void {
|
||||||
this._views.set(component, view);
|
this._views.set(component, view);
|
||||||
this._clearCacheFor(component);
|
this._clearCacheFor(component);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Overrides the inline template for a component - other configuration remains unchanged.
|
* Overrides the inline template for a component - other configuration remains unchanged.
|
||||||
*/
|
*/
|
||||||
setInlineTemplate(component: Type, template: string): void {
|
setInlineTemplate(component: Type<any>, template: string): void {
|
||||||
this._inlineTemplates.set(component, template);
|
this._inlineTemplates.set(component, template);
|
||||||
this._clearCacheFor(component);
|
this._clearCacheFor(component);
|
||||||
}
|
}
|
||||||
|
|
||||||
setAnimations(component: Type, animations: AnimationEntryMetadata[]): void {
|
setAnimations(component: Type<any>, animations: AnimationEntryMetadata[]): void {
|
||||||
this._animations.set(component, animations);
|
this._animations.set(component, animations);
|
||||||
this._clearCacheFor(component);
|
this._clearCacheFor(component);
|
||||||
}
|
}
|
||||||
|
@ -172,11 +173,11 @@ export class MockDirectiveResolver extends DirectiveResolver {
|
||||||
/**
|
/**
|
||||||
* Overrides a directive from the component {@link ViewMetadata}.
|
* Overrides a directive from the component {@link ViewMetadata}.
|
||||||
*/
|
*/
|
||||||
overrideViewDirective(component: Type, from: Type, to: Type): void {
|
overrideViewDirective(component: Type<any>, from: Type<any>, to: Type<any>): void {
|
||||||
var overrides = this._directiveOverrides.get(component);
|
var overrides = this._directiveOverrides.get(component);
|
||||||
|
|
||||||
if (!overrides) {
|
if (!overrides) {
|
||||||
overrides = new Map<Type, Type>();
|
overrides = new Map<Type<any>, Type<any>>();
|
||||||
this._directiveOverrides.set(component, overrides);
|
this._directiveOverrides.set(component, overrides);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,7 +186,7 @@ export class MockDirectiveResolver extends DirectiveResolver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function flattenArray(tree: any[], out: Array<Type|any[]>): void {
|
function flattenArray(tree: any[], out: Array<Type<any>|any[]>): void {
|
||||||
if (!isPresent(tree)) return;
|
if (!isPresent(tree)) return;
|
||||||
for (var i = 0; i < tree.length; i++) {
|
for (var i = 0; i < tree.length; i++) {
|
||||||
var item = resolveForwardRef(tree[i]);
|
var item = resolveForwardRef(tree[i]);
|
||||||
|
|
|
@ -6,10 +6,9 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {BaseException} from '@angular/core';
|
|
||||||
import {MetadataOverride} from '@angular/core/testing';
|
import {MetadataOverride} from '@angular/core/testing';
|
||||||
|
import {BaseException} from '../src/facade/exceptions';
|
||||||
import {ConcreteType, stringify} from '../src/facade/lang';
|
import {stringify} from '../src/facade/lang';
|
||||||
|
|
||||||
type StringMap = {
|
type StringMap = {
|
||||||
[key: string]: any
|
[key: string]: any
|
||||||
|
|
|
@ -13,18 +13,18 @@ import {Map} from '../src/facade/collection';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class MockNgModuleResolver extends NgModuleResolver {
|
export class MockNgModuleResolver extends NgModuleResolver {
|
||||||
private _ngModules = new Map<Type, NgModuleMetadata>();
|
private _ngModules = new Map<Type<any>, NgModuleMetadata>();
|
||||||
|
|
||||||
constructor(private _injector: Injector) { super(); }
|
constructor(private _injector: Injector) { super(); }
|
||||||
|
|
||||||
private get _compiler(): Compiler { return this._injector.get(Compiler); }
|
private get _compiler(): Compiler { return this._injector.get(Compiler); }
|
||||||
|
|
||||||
private _clearCacheFor(component: Type) { this._compiler.clearCacheFor(component); }
|
private _clearCacheFor(component: Type<any>) { this._compiler.clearCacheFor(component); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overrides the {@link NgModuleMetadata} for a module.
|
* Overrides the {@link NgModuleMetadata} for a module.
|
||||||
*/
|
*/
|
||||||
setNgModule(type: Type, metadata: NgModuleMetadata): void {
|
setNgModule(type: Type<any>, metadata: NgModuleMetadata): void {
|
||||||
this._ngModules.set(type, metadata);
|
this._ngModules.set(type, metadata);
|
||||||
this._clearCacheFor(type);
|
this._clearCacheFor(type);
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ export class MockNgModuleResolver extends NgModuleResolver {
|
||||||
* default
|
* default
|
||||||
* `NgModuleResolver`, see `setNgModule`.
|
* `NgModuleResolver`, see `setNgModule`.
|
||||||
*/
|
*/
|
||||||
resolve(type: Type, throwIfNotFound = true): NgModuleMetadata {
|
resolve(type: Type<any>, throwIfNotFound = true): NgModuleMetadata {
|
||||||
var metadata = this._ngModules.get(type);
|
var metadata = this._ngModules.get(type);
|
||||||
if (!metadata) {
|
if (!metadata) {
|
||||||
metadata = super.resolve(type, throwIfNotFound);
|
metadata = super.resolve(type, throwIfNotFound);
|
||||||
|
|
|
@ -13,18 +13,18 @@ import {Map} from '../src/facade/collection';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class MockPipeResolver extends PipeResolver {
|
export class MockPipeResolver extends PipeResolver {
|
||||||
private _pipes = new Map<Type, PipeMetadata>();
|
private _pipes = new Map<Type<any>, PipeMetadata>();
|
||||||
|
|
||||||
constructor(private _injector: Injector) { super(); }
|
constructor(private _injector: Injector) { super(); }
|
||||||
|
|
||||||
private get _compiler(): Compiler { return this._injector.get(Compiler); }
|
private get _compiler(): Compiler { return this._injector.get(Compiler); }
|
||||||
|
|
||||||
private _clearCacheFor(pipe: Type) { this._compiler.clearCacheFor(pipe); }
|
private _clearCacheFor(pipe: Type<any>) { this._compiler.clearCacheFor(pipe); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overrides the {@link PipeMetadata} for a pipe.
|
* Overrides the {@link PipeMetadata} for a pipe.
|
||||||
*/
|
*/
|
||||||
setPipe(type: Type, metadata: PipeMetadata): void {
|
setPipe(type: Type<any>, metadata: PipeMetadata): void {
|
||||||
this._pipes.set(type, metadata);
|
this._pipes.set(type, metadata);
|
||||||
this._clearCacheFor(type);
|
this._clearCacheFor(type);
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ export class MockPipeResolver extends PipeResolver {
|
||||||
* default
|
* default
|
||||||
* `PipeResolver`, see `setPipe`.
|
* `PipeResolver`, see `setPipe`.
|
||||||
*/
|
*/
|
||||||
resolve(type: Type, throwIfNotFound = true): PipeMetadata {
|
resolve(type: Type<any>, throwIfNotFound = true): PipeMetadata {
|
||||||
var metadata = this._pipes.get(type);
|
var metadata = this._pipes.get(type);
|
||||||
if (!metadata) {
|
if (!metadata) {
|
||||||
metadata = super.resolve(type, throwIfNotFound);
|
metadata = super.resolve(type, throwIfNotFound);
|
||||||
|
|
|
@ -6,12 +6,13 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {AnimationEntryMetadata, Compiler, ComponentFactory, Inject, Injectable, Injector, NgZone, ViewMetadata} from '@angular/core';
|
import {AnimationEntryMetadata, Compiler, ComponentFactory, Inject, Injectable, Injector, NgZone, Type, ViewMetadata} from '@angular/core';
|
||||||
import {ComponentFixture, ComponentFixtureNoNgZone, TestBed, TestComponentBuilder} from '@angular/core/testing';
|
import {ComponentFixture, ComponentFixtureNoNgZone, TestBed, TestComponentBuilder} from '@angular/core/testing';
|
||||||
|
|
||||||
import {DirectiveResolver} from '../index';
|
import {DirectiveResolver} from '../index';
|
||||||
import {MapWrapper} from '../src/facade/collection';
|
import {MapWrapper} from '../src/facade/collection';
|
||||||
import {ConcreteType, Type, isPresent} from '../src/facade/lang';
|
import {isPresent} from '../src/facade/lang';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,17 +24,17 @@ import {ConcreteType, Type, isPresent} from '../src/facade/lang';
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class OverridingTestComponentBuilder extends TestComponentBuilder {
|
export class OverridingTestComponentBuilder extends TestComponentBuilder {
|
||||||
/** @internal */
|
/** @internal */
|
||||||
_bindingsOverrides = new Map<Type, any[]>();
|
_bindingsOverrides = new Map<Type<any>, any[]>();
|
||||||
/** @internal */
|
/** @internal */
|
||||||
_directiveOverrides = new Map<Type, Map<Type, Type>>();
|
_directiveOverrides = new Map<Type<any>, Map<Type<any>, Type<any>>>();
|
||||||
/** @internal */
|
/** @internal */
|
||||||
_templateOverrides = new Map<Type, string>();
|
_templateOverrides = new Map<Type<any>, string>();
|
||||||
/** @internal */
|
/** @internal */
|
||||||
_animationOverrides = new Map<Type, AnimationEntryMetadata[]>();
|
_animationOverrides = new Map<Type<any>, AnimationEntryMetadata[]>();
|
||||||
/** @internal */
|
/** @internal */
|
||||||
_viewBindingsOverrides = new Map<Type, any[]>();
|
_viewBindingsOverrides = new Map<Type<any>, any[]>();
|
||||||
/** @internal */
|
/** @internal */
|
||||||
_viewOverrides = new Map<Type, ViewMetadata>();
|
_viewOverrides = new Map<Type<any>, ViewMetadata>();
|
||||||
|
|
||||||
constructor(@Inject(TestBed) injector: Injector) { super(injector); }
|
constructor(@Inject(TestBed) injector: Injector) { super(injector); }
|
||||||
|
|
||||||
|
@ -48,54 +49,55 @@ export class OverridingTestComponentBuilder extends TestComponentBuilder {
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
overrideTemplate(componentType: Type, template: string): OverridingTestComponentBuilder {
|
overrideTemplate(componentType: Type<any>, template: string): OverridingTestComponentBuilder {
|
||||||
let clone = this._clone();
|
let clone = this._clone();
|
||||||
clone._templateOverrides.set(componentType, template);
|
clone._templateOverrides.set(componentType, template);
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
overrideAnimations(componentType: Type, animations: AnimationEntryMetadata[]):
|
overrideAnimations(componentType: Type<any>, animations: AnimationEntryMetadata[]):
|
||||||
TestComponentBuilder {
|
TestComponentBuilder {
|
||||||
var clone = this._clone();
|
var clone = this._clone();
|
||||||
clone._animationOverrides.set(componentType, animations);
|
clone._animationOverrides.set(componentType, animations);
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
overrideView(componentType: Type, view: ViewMetadata): OverridingTestComponentBuilder {
|
overrideView(componentType: Type<any>, view: ViewMetadata): OverridingTestComponentBuilder {
|
||||||
let clone = this._clone();
|
let clone = this._clone();
|
||||||
clone._viewOverrides.set(componentType, view);
|
clone._viewOverrides.set(componentType, view);
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
overrideDirective(componentType: Type, from: Type, to: Type): OverridingTestComponentBuilder {
|
overrideDirective(componentType: Type<any>, from: Type<any>, to: Type<any>):
|
||||||
|
OverridingTestComponentBuilder {
|
||||||
let clone = this._clone();
|
let clone = this._clone();
|
||||||
let overridesForComponent = clone._directiveOverrides.get(componentType);
|
let overridesForComponent = clone._directiveOverrides.get(componentType);
|
||||||
if (!isPresent(overridesForComponent)) {
|
if (!isPresent(overridesForComponent)) {
|
||||||
clone._directiveOverrides.set(componentType, new Map<Type, Type>());
|
clone._directiveOverrides.set(componentType, new Map<Type<any>, Type<any>>());
|
||||||
overridesForComponent = clone._directiveOverrides.get(componentType);
|
overridesForComponent = clone._directiveOverrides.get(componentType);
|
||||||
}
|
}
|
||||||
overridesForComponent.set(from, to);
|
overridesForComponent.set(from, to);
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
overrideProviders(type: Type, providers: any[]): OverridingTestComponentBuilder {
|
overrideProviders(type: Type<any>, providers: any[]): OverridingTestComponentBuilder {
|
||||||
let clone = this._clone();
|
let clone = this._clone();
|
||||||
clone._bindingsOverrides.set(type, providers);
|
clone._bindingsOverrides.set(type, providers);
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
overrideViewProviders(type: Type, providers: any[]): OverridingTestComponentBuilder {
|
overrideViewProviders(type: Type<any>, providers: any[]): OverridingTestComponentBuilder {
|
||||||
let clone = this._clone();
|
let clone = this._clone();
|
||||||
clone._viewBindingsOverrides.set(type, providers);
|
clone._viewBindingsOverrides.set(type, providers);
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
createAsync<T>(rootComponentType: ConcreteType<T>): Promise<ComponentFixture<T>> {
|
createAsync<T>(rootComponentType: Type<T>): Promise<ComponentFixture<T>> {
|
||||||
this._applyMetadataOverrides();
|
this._applyMetadataOverrides();
|
||||||
return super.createAsync(rootComponentType);
|
return super.createAsync(rootComponentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
createSync<T>(rootComponentType: ConcreteType<T>): ComponentFixture<T> {
|
createSync<T>(rootComponentType: Type<T>): ComponentFixture<T> {
|
||||||
this._applyMetadataOverrides();
|
this._applyMetadataOverrides();
|
||||||
return super.createSync(rootComponentType);
|
return super.createSync(rootComponentType);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ export * from './src/platform_core_providers';
|
||||||
export {APPLICATION_COMMON_PROVIDERS, ApplicationModule} from './src/application_module';
|
export {APPLICATION_COMMON_PROVIDERS, ApplicationModule} from './src/application_module';
|
||||||
export {wtfCreateScope, wtfLeave, wtfStartTimeRange, wtfEndTimeRange, WtfScopeFn} from './src/profile/profile';
|
export {wtfCreateScope, wtfLeave, wtfStartTimeRange, wtfEndTimeRange, WtfScopeFn} from './src/profile/profile';
|
||||||
|
|
||||||
export {Type} from './src/facade/lang';
|
export {Type} from './src/type';
|
||||||
export {EventEmitter} from './src/facade/async';
|
export {EventEmitter} from './src/facade/async';
|
||||||
export {ExceptionHandler, WrappedException, BaseException} from './src/facade/exceptions';
|
export {ExceptionHandler, WrappedException, BaseException} from './src/facade/exceptions';
|
||||||
export * from './private_export';
|
export * from './private_export';
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Type} from '../src/facade/lang';
|
|
||||||
|
|
||||||
import {ApplicationInitStatus} from './application_init';
|
import {ApplicationInitStatus} from './application_init';
|
||||||
import {ApplicationRef, ApplicationRef_, isDevMode} from './application_ref';
|
import {ApplicationRef, ApplicationRef_, isDevMode} from './application_ref';
|
||||||
import {APP_ID_RANDOM_PROVIDER} from './application_tokens';
|
import {APP_ID_RANDOM_PROVIDER} from './application_tokens';
|
||||||
|
@ -18,6 +16,7 @@ import {ComponentResolver} from './linker/component_resolver';
|
||||||
import {DynamicComponentLoader, DynamicComponentLoader_} from './linker/dynamic_component_loader';
|
import {DynamicComponentLoader, DynamicComponentLoader_} from './linker/dynamic_component_loader';
|
||||||
import {ViewUtils} from './linker/view_utils';
|
import {ViewUtils} from './linker/view_utils';
|
||||||
import {NgModule} from './metadata';
|
import {NgModule} from './metadata';
|
||||||
|
import {Type} from './type';
|
||||||
|
|
||||||
export function _iterableDiffersFactory() {
|
export function _iterableDiffersFactory() {
|
||||||
return defaultIterableDiffers;
|
return defaultIterableDiffers;
|
||||||
|
@ -33,7 +32,7 @@ export function _keyValueDiffersFactory() {
|
||||||
*
|
*
|
||||||
* @deprecated Include `ApplicationModule` instead.
|
* @deprecated Include `ApplicationModule` instead.
|
||||||
*/
|
*/
|
||||||
export const APPLICATION_COMMON_PROVIDERS: Array<Type|{[k: string]: any}|any[]> = [];
|
export const APPLICATION_COMMON_PROVIDERS: Array<Type<any>|{[k: string]: any}|any[]> = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This module includes the providers of @angular/core that are needed
|
* This module includes the providers of @angular/core that are needed
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
import {ListWrapper} from '../src/facade/collection';
|
import {ListWrapper} from '../src/facade/collection';
|
||||||
import {BaseException, ExceptionHandler, unimplemented} from '../src/facade/exceptions';
|
import {BaseException, ExceptionHandler, unimplemented} from '../src/facade/exceptions';
|
||||||
import {ConcreteType, Type, isBlank, isPresent, isPromise, stringify} from '../src/facade/lang';
|
import {isBlank, isPresent, isPromise, stringify} from '../src/facade/lang';
|
||||||
|
|
||||||
import {ApplicationInitStatus} from './application_init';
|
import {ApplicationInitStatus} from './application_init';
|
||||||
import {APP_BOOTSTRAP_LISTENER, PLATFORM_INITIALIZER} from './application_tokens';
|
import {APP_BOOTSTRAP_LISTENER, PLATFORM_INITIALIZER} from './application_tokens';
|
||||||
|
@ -22,6 +22,7 @@ import {ComponentResolver} from './linker/component_resolver';
|
||||||
import {NgModuleFactory, NgModuleInjector, NgModuleRef} from './linker/ng_module_factory';
|
import {NgModuleFactory, NgModuleInjector, NgModuleRef} from './linker/ng_module_factory';
|
||||||
import {WtfScopeFn, wtfCreateScope, wtfLeave} from './profile/profile';
|
import {WtfScopeFn, wtfCreateScope, wtfLeave} from './profile/profile';
|
||||||
import {Testability, TestabilityRegistry} from './testability/testability';
|
import {Testability, TestabilityRegistry} from './testability/testability';
|
||||||
|
import {Type} from './type';
|
||||||
import {NgZone, NgZoneError} from './zone/ng_zone';
|
import {NgZone, NgZoneError} from './zone/ng_zone';
|
||||||
|
|
||||||
var _devMode: boolean = true;
|
var _devMode: boolean = true;
|
||||||
|
@ -182,7 +183,7 @@ export function coreBootstrap<C>(
|
||||||
* @deprecated Use {@link bootstrapModule} instead.
|
* @deprecated Use {@link bootstrapModule} instead.
|
||||||
*/
|
*/
|
||||||
export function coreLoadAndBootstrap(
|
export function coreLoadAndBootstrap(
|
||||||
componentType: Type, injector: Injector): Promise<ComponentRef<any>> {
|
componentType: Type<any>, injector: Injector): Promise<ComponentRef<any>> {
|
||||||
throw new BaseException('coreLoadAndBootstrap is deprecated. Use bootstrapModule instead.');
|
throw new BaseException('coreLoadAndBootstrap is deprecated. Use bootstrapModule instead.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,9 +240,8 @@ export abstract class PlatformRef {
|
||||||
* ```
|
* ```
|
||||||
* @stable
|
* @stable
|
||||||
*/
|
*/
|
||||||
bootstrapModule<M>(
|
bootstrapModule<M>(moduleType: Type<M>, compilerOptions: CompilerOptions|CompilerOptions[] = []):
|
||||||
moduleType: ConcreteType<M>,
|
Promise<NgModuleRef<M>> {
|
||||||
compilerOptions: CompilerOptions|CompilerOptions[] = []): Promise<NgModuleRef<M>> {
|
|
||||||
throw unimplemented();
|
throw unimplemented();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,14 +373,13 @@ export class PlatformRef_ extends PlatformRef {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bootstrapModule<M>(
|
bootstrapModule<M>(moduleType: Type<M>, compilerOptions: CompilerOptions|CompilerOptions[] = []):
|
||||||
moduleType: ConcreteType<M>,
|
Promise<NgModuleRef<M>> {
|
||||||
compilerOptions: CompilerOptions|CompilerOptions[] = []): Promise<NgModuleRef<M>> {
|
|
||||||
return this._bootstrapModuleWithZone(moduleType, compilerOptions, null);
|
return this._bootstrapModuleWithZone(moduleType, compilerOptions, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _bootstrapModuleWithZone<M>(
|
private _bootstrapModuleWithZone<M>(
|
||||||
moduleType: ConcreteType<M>, compilerOptions: CompilerOptions|CompilerOptions[] = [],
|
moduleType: Type<M>, compilerOptions: CompilerOptions|CompilerOptions[] = [],
|
||||||
ngZone: NgZone): Promise<NgModuleRef<M>> {
|
ngZone: NgZone): Promise<NgModuleRef<M>> {
|
||||||
const compilerFactory: CompilerFactory = this.injector.get(CompilerFactory);
|
const compilerFactory: CompilerFactory = this.injector.get(CompilerFactory);
|
||||||
const compiler = compilerFactory.createCompiler(
|
const compiler = compilerFactory.createCompiler(
|
||||||
|
@ -455,7 +454,7 @@ export abstract class ApplicationRef {
|
||||||
* ### Example
|
* ### Example
|
||||||
* {@example core/ts/platform/platform.ts region='longform'}
|
* {@example core/ts/platform/platform.ts region='longform'}
|
||||||
*/
|
*/
|
||||||
abstract bootstrap<C>(componentFactory: ComponentFactory<C>|ConcreteType<C>): ComponentRef<C>;
|
abstract bootstrap<C>(componentFactory: ComponentFactory<C>|Type<C>): ComponentRef<C>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the application {@link Injector}.
|
* Retrieve the application {@link Injector}.
|
||||||
|
@ -496,7 +495,7 @@ export abstract class ApplicationRef {
|
||||||
* Get a list of component types registered to this application.
|
* Get a list of component types registered to this application.
|
||||||
* This list is populated even before the component is created.
|
* This list is populated even before the component is created.
|
||||||
*/
|
*/
|
||||||
get componentTypes(): Type[] { return <Type[]>unimplemented(); };
|
get componentTypes(): Type<any>[] { return <Type<any>[]>unimplemented(); };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of components registered to this application.
|
* Get a list of components registered to this application.
|
||||||
|
@ -515,7 +514,7 @@ export class ApplicationRef_ extends ApplicationRef {
|
||||||
*/
|
*/
|
||||||
private _disposeListeners: Function[] = [];
|
private _disposeListeners: Function[] = [];
|
||||||
private _rootComponents: ComponentRef<any>[] = [];
|
private _rootComponents: ComponentRef<any>[] = [];
|
||||||
private _rootComponentTypes: Type[] = [];
|
private _rootComponentTypes: Type<any>[] = [];
|
||||||
private _changeDetectorRefs: ChangeDetectorRef[] = [];
|
private _changeDetectorRefs: ChangeDetectorRef[] = [];
|
||||||
private _runningTick: boolean = false;
|
private _runningTick: boolean = false;
|
||||||
private _enforceNoNewChanges: boolean = false;
|
private _enforceNoNewChanges: boolean = false;
|
||||||
|
@ -567,7 +566,7 @@ export class ApplicationRef_ extends ApplicationRef {
|
||||||
() => _callAndReportToExceptionHandler(this._exceptionHandler, <any>callback));
|
() => _callAndReportToExceptionHandler(this._exceptionHandler, <any>callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
bootstrap<C>(componentOrFactory: ComponentFactory<C>|ConcreteType<C>): ComponentRef<C> {
|
bootstrap<C>(componentOrFactory: ComponentFactory<C>|Type<C>): ComponentRef<C> {
|
||||||
if (!this._initStatus.done) {
|
if (!this._initStatus.done) {
|
||||||
throw new BaseException(
|
throw new BaseException(
|
||||||
'Cannot bootstrap as there are still asynchronous initializers running. Bootstrap components in the `ngDoBootstrap` method of the root module.');
|
'Cannot bootstrap as there are still asynchronous initializers running. Bootstrap components in the `ngDoBootstrap` method of the root module.');
|
||||||
|
@ -655,7 +654,7 @@ export class ApplicationRef_ extends ApplicationRef {
|
||||||
*/
|
*/
|
||||||
dispose(): void { this.ngOnDestroy(); }
|
dispose(): void { this.ngOnDestroy(); }
|
||||||
|
|
||||||
get componentTypes(): Type[] { return this._rootComponentTypes; }
|
get componentTypes(): Type<any>[] { return this._rootComponentTypes; }
|
||||||
|
|
||||||
get components(): ComponentRef<any>[] { return this._rootComponents; }
|
get components(): ComponentRef<any>[] { return this._rootComponents; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Type, isFunction, stringify} from '../facade/lang';
|
import {isFunction, stringify} from '../facade/lang';
|
||||||
|
import {Type} from '../type';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,10 +32,10 @@ export interface ForwardRefFn { (): any; }
|
||||||
* {@example core/di/ts/forward_ref/forward_ref.ts region='forward_ref'}
|
* {@example core/di/ts/forward_ref/forward_ref.ts region='forward_ref'}
|
||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
export function forwardRef(forwardRefFn: ForwardRefFn): Type {
|
export function forwardRef(forwardRefFn: ForwardRefFn): Type<any> {
|
||||||
(<any>forwardRefFn).__forward_ref__ = forwardRef;
|
(<any>forwardRefFn).__forward_ref__ = forwardRef;
|
||||||
(<any>forwardRefFn).toString = function() { return stringify(this()); };
|
(<any>forwardRefFn).toString = function() { return stringify(this()); };
|
||||||
return (<Type><any>forwardRefFn);
|
return (<Type<any>><any>forwardRefFn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -7,7 +7,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {BaseException} from '../facade/exceptions';
|
import {BaseException} from '../facade/exceptions';
|
||||||
import {Type, isBlank, isFunction, isType, normalizeBool, stringify} from '../facade/lang';
|
import {isBlank, isFunction, isType, normalizeBool, stringify} from '../facade/lang';
|
||||||
|
import {Type} from '../type';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,7 +62,7 @@ export class Provider {
|
||||||
* expect(injectorAlias.get(Vehicle) instanceof Car).toBe(true);
|
* expect(injectorAlias.get(Vehicle) instanceof Car).toBe(true);
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
useClass: Type;
|
useClass: Type<any>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Binds a DI token to a value.
|
* Binds a DI token to a value.
|
||||||
|
@ -157,7 +158,7 @@ export class Provider {
|
||||||
_multi: boolean;
|
_multi: boolean;
|
||||||
|
|
||||||
constructor(token: any, {useClass, useValue, useExisting, useFactory, deps, multi}: {
|
constructor(token: any, {useClass, useValue, useExisting, useFactory, deps, multi}: {
|
||||||
useClass?: Type,
|
useClass?: Type<any>,
|
||||||
useValue?: any,
|
useValue?: any,
|
||||||
useExisting?: any,
|
useExisting?: any,
|
||||||
useFactory?: Function,
|
useFactory?: Function,
|
||||||
|
@ -213,7 +214,7 @@ export class Provider {
|
||||||
*/
|
*/
|
||||||
export class Binding extends Provider {
|
export class Binding extends Provider {
|
||||||
constructor(token: any, {toClass, toValue, toAlias, toFactory, deps, multi}: {
|
constructor(token: any, {toClass, toValue, toAlias, toFactory, deps, multi}: {
|
||||||
toClass?: Type,
|
toClass?: Type<any>,
|
||||||
toValue?: any,
|
toValue?: any,
|
||||||
toAlias?: any,
|
toAlias?: any,
|
||||||
toFactory: Function, deps?: Object[], multi?: boolean
|
toFactory: Function, deps?: Object[], multi?: boolean
|
||||||
|
@ -301,7 +302,7 @@ export class ProviderBuilder {
|
||||||
* expect(injectorAlias.get(Vehicle) instanceof Car).toBe(true);
|
* expect(injectorAlias.get(Vehicle) instanceof Car).toBe(true);
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
toClass(type: Type): Provider {
|
toClass(type: Type<any>): Provider {
|
||||||
if (!isType(type)) {
|
if (!isType(type)) {
|
||||||
throw new BaseException(
|
throw new BaseException(
|
||||||
`Trying to create a class provider but "${stringify(type)}" is not a class!`);
|
`Trying to create a class provider but "${stringify(type)}" is not a class!`);
|
||||||
|
@ -396,7 +397,7 @@ export class ProviderBuilder {
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
export function provide(token: any, {useClass, useValue, useExisting, useFactory, deps, multi}: {
|
export function provide(token: any, {useClass, useValue, useExisting, useFactory, deps, multi}: {
|
||||||
useClass?: Type,
|
useClass?: Type<any>,
|
||||||
useValue?: any,
|
useValue?: any,
|
||||||
useExisting?: any,
|
useExisting?: any,
|
||||||
useFactory?: Function,
|
useFactory?: Function,
|
||||||
|
|
|
@ -8,7 +8,8 @@
|
||||||
|
|
||||||
import {ListWrapper} from '../facade/collection';
|
import {ListWrapper} from '../facade/collection';
|
||||||
import {BaseException, WrappedException} from '../facade/exceptions';
|
import {BaseException, WrappedException} from '../facade/exceptions';
|
||||||
import {Type, isBlank, stringify} from '../facade/lang';
|
import {isBlank, stringify} from '../facade/lang';
|
||||||
|
import {Type} from '../type';
|
||||||
|
|
||||||
import {Provider} from './provider';
|
import {Provider} from './provider';
|
||||||
import {ReflectiveInjector} from './reflective_injector';
|
import {ReflectiveInjector} from './reflective_injector';
|
||||||
|
@ -225,11 +226,11 @@ export class InvalidProviderError extends BaseException {
|
||||||
* @stable
|
* @stable
|
||||||
*/
|
*/
|
||||||
export class NoAnnotationError extends BaseException {
|
export class NoAnnotationError extends BaseException {
|
||||||
constructor(typeOrFunc: Type|Function, params: any[][]) {
|
constructor(typeOrFunc: Type<any>|Function, params: any[][]) {
|
||||||
super(NoAnnotationError._genMessage(typeOrFunc, params));
|
super(NoAnnotationError._genMessage(typeOrFunc, params));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static _genMessage(typeOrFunc: Type|Function, params: any[][]) {
|
private static _genMessage(typeOrFunc: Type<any>|Function, params: any[][]) {
|
||||||
var signature: string[] = [];
|
var signature: string[] = [];
|
||||||
for (var i = 0, ii = params.length; i < ii; i++) {
|
for (var i = 0, ii = params.length; i < ii; i++) {
|
||||||
var parameter = params[i];
|
var parameter = params[i];
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
import {ListWrapper} from '../facade/collection';
|
import {ListWrapper} from '../facade/collection';
|
||||||
import {BaseException, unimplemented} from '../facade/exceptions';
|
import {BaseException, unimplemented} from '../facade/exceptions';
|
||||||
import {Type} from '../facade/lang';
|
import {Type} from '../type';
|
||||||
|
|
||||||
import {Injector, THROW_IF_NOT_FOUND} from './injector';
|
import {Injector, THROW_IF_NOT_FOUND} from './injector';
|
||||||
import {SelfMetadata, SkipSelfMetadata} from './metadata';
|
import {SelfMetadata, SkipSelfMetadata} from './metadata';
|
||||||
|
@ -17,7 +17,7 @@ import {AbstractProviderError, CyclicDependencyError, InstantiationError, NoProv
|
||||||
import {ReflectiveKey} from './reflective_key';
|
import {ReflectiveKey} from './reflective_key';
|
||||||
import {ReflectiveDependency, ResolvedReflectiveFactory, ResolvedReflectiveProvider, resolveReflectiveProviders} from './reflective_provider';
|
import {ReflectiveDependency, ResolvedReflectiveFactory, ResolvedReflectiveProvider, resolveReflectiveProviders} from './reflective_provider';
|
||||||
|
|
||||||
var __unused: Type; // avoid unused import when Type union types are erased
|
var __unused: Type<any>; // avoid unused import when Type union types are erased
|
||||||
|
|
||||||
// Threshold for the dynamic version
|
// Threshold for the dynamic version
|
||||||
const _MAX_CONSTRUCTION_COUNTER = 10;
|
const _MAX_CONSTRUCTION_COUNTER = 10;
|
||||||
|
@ -392,7 +392,7 @@ export abstract class ReflectiveInjector implements Injector {
|
||||||
*
|
*
|
||||||
* See {@link ReflectiveInjector#fromResolvedProviders} for more info.
|
* See {@link ReflectiveInjector#fromResolvedProviders} for more info.
|
||||||
*/
|
*/
|
||||||
static resolve(providers: Array<Type|Provider|{[k: string]: any}|any[]>):
|
static resolve(providers: Array<Type<any>|Provider|{[k: string]: any}|any[]>):
|
||||||
ResolvedReflectiveProvider[] {
|
ResolvedReflectiveProvider[] {
|
||||||
return resolveReflectiveProviders(providers);
|
return resolveReflectiveProviders(providers);
|
||||||
}
|
}
|
||||||
|
@ -424,7 +424,7 @@ export abstract class ReflectiveInjector implements Injector {
|
||||||
* See {@link Injector#resolve} and {@link Injector#fromResolvedProviders}.
|
* See {@link Injector#resolve} and {@link Injector#fromResolvedProviders}.
|
||||||
*/
|
*/
|
||||||
static resolveAndCreate(
|
static resolveAndCreate(
|
||||||
providers: Array<Type|Provider|{[k: string]: any}|any[]>,
|
providers: Array<Type<any>|Provider|{[k: string]: any}|any[]>,
|
||||||
parent: Injector = null): ReflectiveInjector {
|
parent: Injector = null): ReflectiveInjector {
|
||||||
var ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
|
var ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
|
||||||
return ReflectiveInjector.fromResolvedProviders(ResolvedReflectiveProviders, parent);
|
return ReflectiveInjector.fromResolvedProviders(ResolvedReflectiveProviders, parent);
|
||||||
|
@ -516,7 +516,7 @@ export abstract class ReflectiveInjector implements Injector {
|
||||||
* because it needs to resolve the passed-in providers first.
|
* because it needs to resolve the passed-in providers first.
|
||||||
* See {@link Injector#resolve} and {@link Injector#createChildFromResolved}.
|
* See {@link Injector#resolve} and {@link Injector#createChildFromResolved}.
|
||||||
*/
|
*/
|
||||||
resolveAndCreateChild(providers: Array<Type|Provider|{[k: string]: any}|any[]>):
|
resolveAndCreateChild(providers: Array<Type<any>|Provider|{[k: string]: any}|any[]>):
|
||||||
ReflectiveInjector {
|
ReflectiveInjector {
|
||||||
return unimplemented();
|
return unimplemented();
|
||||||
}
|
}
|
||||||
|
@ -574,7 +574,7 @@ export abstract class ReflectiveInjector implements Injector {
|
||||||
* expect(car).not.toBe(injector.resolveAndInstantiate(Car));
|
* expect(car).not.toBe(injector.resolveAndInstantiate(Car));
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
resolveAndInstantiate(provider: Type|Provider): any { return unimplemented(); }
|
resolveAndInstantiate(provider: Type<any>|Provider): any { return unimplemented(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates an object using a resolved provider in the context of the injector.
|
* Instantiates an object using a resolved provider in the context of the injector.
|
||||||
|
@ -644,7 +644,7 @@ export class ReflectiveInjector_ implements ReflectiveInjector {
|
||||||
*/
|
*/
|
||||||
get internalStrategy(): any { return this._strategy; }
|
get internalStrategy(): any { return this._strategy; }
|
||||||
|
|
||||||
resolveAndCreateChild(providers: Array<Type|Provider|any[]>): ReflectiveInjector {
|
resolveAndCreateChild(providers: Array<Type<any>|Provider|any[]>): ReflectiveInjector {
|
||||||
var ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
|
var ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
|
||||||
return this.createChildFromResolved(ResolvedReflectiveProviders);
|
return this.createChildFromResolved(ResolvedReflectiveProviders);
|
||||||
}
|
}
|
||||||
|
@ -656,7 +656,7 @@ export class ReflectiveInjector_ implements ReflectiveInjector {
|
||||||
return inj;
|
return inj;
|
||||||
}
|
}
|
||||||
|
|
||||||
resolveAndInstantiate(provider: Type|Provider): any {
|
resolveAndInstantiate(provider: Type<any>|Provider): any {
|
||||||
return this.instantiateResolved(ReflectiveInjector.resolve([provider])[0]);
|
return this.instantiateResolved(ReflectiveInjector.resolve([provider])[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {ListWrapper, MapWrapper} from '../facade/collection';
|
import {ListWrapper, MapWrapper} from '../facade/collection';
|
||||||
import {Type, isArray, isBlank, isPresent} from '../facade/lang';
|
import {isArray, isBlank, isPresent} from '../facade/lang';
|
||||||
import {reflector} from '../reflection/reflection';
|
import {reflector} from '../reflection/reflection';
|
||||||
|
import {Type} from '../type';
|
||||||
|
|
||||||
import {resolveForwardRef} from './forward_ref';
|
import {resolveForwardRef} from './forward_ref';
|
||||||
import {DependencyMetadata, HostMetadata, InjectMetadata, OptionalMetadata, SelfMetadata, SkipSelfMetadata} from './metadata';
|
import {DependencyMetadata, HostMetadata, InjectMetadata, OptionalMetadata, SelfMetadata, SkipSelfMetadata} from './metadata';
|
||||||
|
@ -18,6 +19,7 @@ import {InvalidProviderError, MixingMultiProvidersWithRegularProvidersError, NoA
|
||||||
import {ReflectiveKey} from './reflective_key';
|
import {ReflectiveKey} from './reflective_key';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* `Dependency` is used by the framework to extend DI.
|
* `Dependency` is used by the framework to extend DI.
|
||||||
* This is internal to Angular and should not be used directly.
|
* This is internal to Angular and should not be used directly.
|
||||||
|
@ -54,7 +56,7 @@ const _EMPTY_LIST: any[] = [];
|
||||||
*/
|
*/
|
||||||
export interface ResolvedReflectiveProvider {
|
export interface ResolvedReflectiveProvider {
|
||||||
/**
|
/**
|
||||||
* A key, usually a `Type`.
|
* A key, usually a `Type<any>`.
|
||||||
*/
|
*/
|
||||||
key: ReflectiveKey;
|
key: ReflectiveKey;
|
||||||
|
|
||||||
|
@ -140,7 +142,7 @@ export function resolveReflectiveProvider(provider: Provider): ResolvedReflectiv
|
||||||
* Resolve a list of Providers.
|
* Resolve a list of Providers.
|
||||||
*/
|
*/
|
||||||
export function resolveReflectiveProviders(
|
export function resolveReflectiveProviders(
|
||||||
providers: Array<Type|Provider|{[k: string]: any}|any[]>): ResolvedReflectiveProvider[] {
|
providers: Array<Type<any>|Provider|{[k: string]: any}|any[]>): ResolvedReflectiveProvider[] {
|
||||||
var normalized = _normalizeProviders(providers, []);
|
var normalized = _normalizeProviders(providers, []);
|
||||||
var resolved = normalized.map(resolveReflectiveProvider);
|
var resolved = normalized.map(resolveReflectiveProvider);
|
||||||
return MapWrapper.values(
|
return MapWrapper.values(
|
||||||
|
@ -185,7 +187,7 @@ export function mergeResolvedReflectiveProviders(
|
||||||
}
|
}
|
||||||
|
|
||||||
function _normalizeProviders(
|
function _normalizeProviders(
|
||||||
providers: Array<Type|Provider|{[k: string]: any}|ProviderBuilder|any[]>,
|
providers: Array<Type<any>|Provider|{[k: string]: any}|ProviderBuilder|any[]>,
|
||||||
res: Provider[]): Provider[] {
|
res: Provider[]): Provider[] {
|
||||||
providers.forEach(b => {
|
providers.forEach(b => {
|
||||||
if (b instanceof Type) {
|
if (b instanceof Type) {
|
||||||
|
|
|
@ -6,23 +6,24 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Injector, OpaqueToken} from '../di';
|
import {OpaqueToken} from '../di';
|
||||||
import {BaseException, unimplemented} from '../facade/exceptions';
|
import {BaseException} from '../facade/exceptions';
|
||||||
import {ConcreteType, Type, stringify} from '../facade/lang';
|
import {stringify} from '../facade/lang';
|
||||||
import {NgModuleMetadata, ViewEncapsulation} from '../metadata';
|
import {ViewEncapsulation} from '../metadata';
|
||||||
|
import {Type} from '../type';
|
||||||
|
|
||||||
import {ComponentFactory} from './component_factory';
|
import {ComponentFactory} from './component_factory';
|
||||||
import {ComponentResolver} from './component_resolver';
|
|
||||||
import {NgModuleFactory} from './ng_module_factory';
|
import {NgModuleFactory} from './ng_module_factory';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates that a component is still being loaded in a synchronous compile.
|
* Indicates that a component is still being loaded in a synchronous compile.
|
||||||
*
|
*
|
||||||
* @stable
|
* @stable
|
||||||
*/
|
*/
|
||||||
export class ComponentStillLoadingError extends BaseException {
|
export class ComponentStillLoadingError extends BaseException {
|
||||||
constructor(public compType: Type) {
|
constructor(public compType: Type<any>) {
|
||||||
super(`Can't compile synchronously as ${stringify(compType)} is still being loaded!`);
|
super(`Can't compile synchronously as ${stringify(compType)} is still being loaded!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,7 +58,7 @@ export class Compiler {
|
||||||
/**
|
/**
|
||||||
* Loads the template and styles of a component and returns the associated `ComponentFactory`.
|
* Loads the template and styles of a component and returns the associated `ComponentFactory`.
|
||||||
*/
|
*/
|
||||||
compileComponentAsync<T>(component: ConcreteType<T>, ngModule: Type = null):
|
compileComponentAsync<T>(component: Type<T>, ngModule: Type<any> = null):
|
||||||
Promise<ComponentFactory<T>> {
|
Promise<ComponentFactory<T>> {
|
||||||
throw _throwError();
|
throw _throwError();
|
||||||
}
|
}
|
||||||
|
@ -65,7 +66,7 @@ export class Compiler {
|
||||||
* Compiles the given component. All templates have to be either inline or compiled via
|
* Compiles the given component. All templates have to be either inline or compiled via
|
||||||
* `compileComponentAsync` before. Otherwise throws a {@link ComponentStillLoadingError}.
|
* `compileComponentAsync` before. Otherwise throws a {@link ComponentStillLoadingError}.
|
||||||
*/
|
*/
|
||||||
compileComponentSync<T>(component: ConcreteType<T>, ngModule: Type = null): ComponentFactory<T> {
|
compileComponentSync<T>(component: Type<T>, ngModule: Type<any> = null): ComponentFactory<T> {
|
||||||
throw _throwError();
|
throw _throwError();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -73,27 +74,24 @@ export class Compiler {
|
||||||
* in `entryComponents`
|
* in `entryComponents`
|
||||||
* have to be inlined. Otherwise throws a {@link ComponentStillLoadingError}.
|
* have to be inlined. Otherwise throws a {@link ComponentStillLoadingError}.
|
||||||
*/
|
*/
|
||||||
compileModuleSync<T>(moduleType: ConcreteType<T>): NgModuleFactory<T> { throw _throwError(); }
|
compileModuleSync<T>(moduleType: Type<T>): NgModuleFactory<T> { throw _throwError(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compiles the given NgModule and all of its components
|
* Compiles the given NgModule and all of its components
|
||||||
*/
|
*/
|
||||||
compileModuleAsync<T>(moduleType: ConcreteType<T>): Promise<NgModuleFactory<T>> {
|
compileModuleAsync<T>(moduleType: Type<T>): Promise<NgModuleFactory<T>> { throw _throwError(); }
|
||||||
throw _throwError();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Same as {@link compileModuleSync} put also creates ComponentFactories for all components.
|
* Same as {@link compileModuleSync} put also creates ComponentFactories for all components.
|
||||||
*/
|
*/
|
||||||
compileModuleAndAllComponentsSync<T>(moduleType: ConcreteType<T>):
|
compileModuleAndAllComponentsSync<T>(moduleType: Type<T>): ModuleWithComponentFactories<T> {
|
||||||
ModuleWithComponentFactories<T> {
|
|
||||||
throw _throwError();
|
throw _throwError();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Same as {@link compileModuleAsync} put also creates ComponentFactories for all components.
|
* Same as {@link compileModuleAsync} put also creates ComponentFactories for all components.
|
||||||
*/
|
*/
|
||||||
compileModuleAndAllComponentsAsync<T>(moduleType: ConcreteType<T>):
|
compileModuleAndAllComponentsAsync<T>(moduleType: Type<T>):
|
||||||
Promise<ModuleWithComponentFactories<T>> {
|
Promise<ModuleWithComponentFactories<T>> {
|
||||||
throw _throwError();
|
throw _throwError();
|
||||||
}
|
}
|
||||||
|
@ -106,7 +104,7 @@ export class Compiler {
|
||||||
/**
|
/**
|
||||||
* Clears the cache for the given component/ngModule.
|
* Clears the cache for the given component/ngModule.
|
||||||
*/
|
*/
|
||||||
clearCacheFor(type: Type) {}
|
clearCacheFor(type: Type<any>) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
import {ChangeDetectorRef} from '../change_detection/change_detection';
|
import {ChangeDetectorRef} from '../change_detection/change_detection';
|
||||||
import {Injector} from '../di/injector';
|
import {Injector} from '../di/injector';
|
||||||
import {unimplemented} from '../facade/exceptions';
|
import {unimplemented} from '../facade/exceptions';
|
||||||
import {Type, isBlank} from '../facade/lang';
|
import {isBlank} from '../facade/lang';
|
||||||
|
import {Type} from '../type';
|
||||||
import {AppElement} from './element';
|
import {AppElement} from './element';
|
||||||
import {ElementRef} from './element_ref';
|
import {ElementRef} from './element_ref';
|
||||||
import {ViewRef} from './view_ref';
|
import {ViewRef} from './view_ref';
|
||||||
|
@ -53,7 +54,7 @@ export abstract class ComponentRef<C> {
|
||||||
/**
|
/**
|
||||||
* The component type.
|
* The component type.
|
||||||
*/
|
*/
|
||||||
get componentType(): Type { return unimplemented(); }
|
get componentType(): Type<any> { return unimplemented(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroys the component instance and all of the data structures associated with it.
|
* Destroys the component instance and all of the data structures associated with it.
|
||||||
|
@ -67,13 +68,13 @@ export abstract class ComponentRef<C> {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ComponentRef_<C> extends ComponentRef<C> {
|
export class ComponentRef_<C> extends ComponentRef<C> {
|
||||||
constructor(private _hostElement: AppElement, private _componentType: Type) { super(); }
|
constructor(private _hostElement: AppElement, private _componentType: Type<any>) { super(); }
|
||||||
get location(): ElementRef { return this._hostElement.elementRef; }
|
get location(): ElementRef { return this._hostElement.elementRef; }
|
||||||
get injector(): Injector { return this._hostElement.injector; }
|
get injector(): Injector { return this._hostElement.injector; }
|
||||||
get instance(): C { return this._hostElement.component; };
|
get instance(): C { return this._hostElement.component; };
|
||||||
get hostView(): ViewRef { return this._hostElement.parentView.ref; };
|
get hostView(): ViewRef { return this._hostElement.parentView.ref; };
|
||||||
get changeDetectorRef(): ChangeDetectorRef { return this._hostElement.parentView.ref; };
|
get changeDetectorRef(): ChangeDetectorRef { return this._hostElement.parentView.ref; };
|
||||||
get componentType(): Type { return this._componentType; }
|
get componentType(): Type<any> { return this._componentType; }
|
||||||
|
|
||||||
destroy(): void { this._hostElement.parentView.destroy(); }
|
destroy(): void { this._hostElement.parentView.destroy(); }
|
||||||
onDestroy(callback: Function): void { this.hostView.onDestroy(callback); }
|
onDestroy(callback: Function): void { this.hostView.onDestroy(callback); }
|
||||||
|
@ -89,9 +90,9 @@ const EMPTY_CONTEXT = new Object();
|
||||||
*/
|
*/
|
||||||
export class ComponentFactory<C> {
|
export class ComponentFactory<C> {
|
||||||
constructor(
|
constructor(
|
||||||
public selector: string, private _viewFactory: Function, private _componentType: Type) {}
|
public selector: string, private _viewFactory: Function, private _componentType: Type<any>) {}
|
||||||
|
|
||||||
get componentType(): Type { return this._componentType; }
|
get componentType(): Type<any> { return this._componentType; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new component.
|
* Creates a new component.
|
||||||
|
|
|
@ -7,9 +7,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {BaseException} from '../facade/exceptions';
|
import {BaseException} from '../facade/exceptions';
|
||||||
import {ConcreteType, stringify} from '../facade/lang';
|
import {stringify} from '../facade/lang';
|
||||||
|
import {Type} from '../type';
|
||||||
|
|
||||||
import {ComponentFactory} from './component_factory';
|
import {ComponentFactory} from './component_factory';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @stable
|
* @stable
|
||||||
*/
|
*/
|
||||||
|
@ -30,7 +33,7 @@ class _NullComponentFactoryResolver implements ComponentFactoryResolver {
|
||||||
*/
|
*/
|
||||||
export abstract class ComponentFactoryResolver {
|
export abstract class ComponentFactoryResolver {
|
||||||
static NULL: ComponentFactoryResolver = new _NullComponentFactoryResolver();
|
static NULL: ComponentFactoryResolver = new _NullComponentFactoryResolver();
|
||||||
abstract resolveComponentFactory<T>(component: ConcreteType<T>): ComponentFactory<T>;
|
abstract resolveComponentFactory<T>(component: Type<T>): ComponentFactory<T>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CodegenComponentFactoryResolver implements ComponentFactoryResolver {
|
export class CodegenComponentFactoryResolver implements ComponentFactoryResolver {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Type} from '../facade/lang';
|
import {Type} from '../type';
|
||||||
import {ComponentFactory} from './component_factory';
|
import {ComponentFactory} from './component_factory';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,6 +25,6 @@ export abstract class ComponentResolver {
|
||||||
'ComponentResolver is deprecated for lazy loading. Use NgModuleFactoryLoader instead.';
|
'ComponentResolver is deprecated for lazy loading. Use NgModuleFactoryLoader instead.';
|
||||||
|
|
||||||
|
|
||||||
abstract resolveComponent(component: Type|string): Promise<ComponentFactory<any>>;
|
abstract resolveComponent(component: Type<any>|string): Promise<ComponentFactory<any>>;
|
||||||
abstract clearCache(): void;
|
abstract clearCache(): void;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Injectable, Injector, ReflectiveInjector, ResolvedReflectiveProvider} from '../di';
|
import {Injectable, Injector, ReflectiveInjector, ResolvedReflectiveProvider} from '../di';
|
||||||
import {Type, isPresent} from '../facade/lang';
|
import {isPresent} from '../facade/lang';
|
||||||
|
import {Type} from '../type';
|
||||||
import {Compiler} from './compiler';
|
import {Compiler} from './compiler';
|
||||||
import {ComponentRef} from './component_factory';
|
import {ComponentRef} from './component_factory';
|
||||||
import {ViewContainerRef} from './view_container_ref';
|
import {ViewContainerRef} from './view_container_ref';
|
||||||
|
@ -70,8 +70,8 @@ export abstract class DynamicComponentLoader {
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
abstract loadAsRoot(
|
abstract loadAsRoot(
|
||||||
type: Type, overrideSelectorOrNode: string|any, injector: Injector, onDispose?: () => void,
|
type: Type<any>, overrideSelectorOrNode: string|any, injector: Injector,
|
||||||
projectableNodes?: any[][]): Promise<ComponentRef<any>>;
|
onDispose?: () => void, projectableNodes?: any[][]): Promise<ComponentRef<any>>;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -115,7 +115,7 @@ export abstract class DynamicComponentLoader {
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
abstract loadNextToLocation(
|
abstract loadNextToLocation(
|
||||||
type: Type, location: ViewContainerRef, providers?: ResolvedReflectiveProvider[],
|
type: Type<any>, location: ViewContainerRef, providers?: ResolvedReflectiveProvider[],
|
||||||
projectableNodes?: any[][]): Promise<ComponentRef<any>>;
|
projectableNodes?: any[][]): Promise<ComponentRef<any>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,8 +124,8 @@ export class DynamicComponentLoader_ extends DynamicComponentLoader {
|
||||||
constructor(private _compiler: Compiler) { super(); }
|
constructor(private _compiler: Compiler) { super(); }
|
||||||
|
|
||||||
loadAsRoot(
|
loadAsRoot(
|
||||||
type: Type, overrideSelectorOrNode: string|any, injector: Injector, onDispose?: () => void,
|
type: Type<any>, overrideSelectorOrNode: string|any, injector: Injector,
|
||||||
projectableNodes?: any[][]): Promise<ComponentRef<any>> {
|
onDispose?: () => void, projectableNodes?: any[][]): Promise<ComponentRef<any>> {
|
||||||
return this._compiler.compileComponentAsync(<any>type).then(componentFactory => {
|
return this._compiler.compileComponentAsync(<any>type).then(componentFactory => {
|
||||||
var componentRef = componentFactory.create(
|
var componentRef = componentFactory.create(
|
||||||
injector, projectableNodes,
|
injector, projectableNodes,
|
||||||
|
@ -138,7 +138,7 @@ export class DynamicComponentLoader_ extends DynamicComponentLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
loadNextToLocation(
|
loadNextToLocation(
|
||||||
type: Type, location: ViewContainerRef, providers: ResolvedReflectiveProvider[] = null,
|
type: Type<any>, location: ViewContainerRef, providers: ResolvedReflectiveProvider[] = null,
|
||||||
projectableNodes: any[][] = null): Promise<ComponentRef<any>> {
|
projectableNodes: any[][] = null): Promise<ComponentRef<any>> {
|
||||||
return this._compiler.compileComponentAsync(<any>type).then(componentFactory => {
|
return this._compiler.compileComponentAsync(<any>type).then(componentFactory => {
|
||||||
var contextInjector = location.parentInjector;
|
var contextInjector = location.parentInjector;
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
|
|
||||||
import {Injector, THROW_IF_NOT_FOUND} from '../di/injector';
|
import {Injector, THROW_IF_NOT_FOUND} from '../di/injector';
|
||||||
import {BaseException, unimplemented} from '../facade/exceptions';
|
import {BaseException, unimplemented} from '../facade/exceptions';
|
||||||
import {ConcreteType, stringify} from '../facade/lang';
|
import {stringify} from '../facade/lang';
|
||||||
|
import {Type} from '../type';
|
||||||
import {ComponentFactory} from './component_factory';
|
import {ComponentFactory} from './component_factory';
|
||||||
import {CodegenComponentFactoryResolver, ComponentFactoryResolver} from './component_factory_resolver';
|
import {CodegenComponentFactoryResolver, ComponentFactoryResolver} from './component_factory_resolver';
|
||||||
|
|
||||||
|
@ -57,9 +57,9 @@ export abstract class NgModuleRef<T> {
|
||||||
export class NgModuleFactory<T> {
|
export class NgModuleFactory<T> {
|
||||||
constructor(
|
constructor(
|
||||||
private _injectorClass: {new (parentInjector: Injector): NgModuleInjector<T>},
|
private _injectorClass: {new (parentInjector: Injector): NgModuleInjector<T>},
|
||||||
private _moduleype: ConcreteType<T>) {}
|
private _moduleype: Type<T>) {}
|
||||||
|
|
||||||
get moduleType(): ConcreteType<T> { return this._moduleype; }
|
get moduleType(): Type<T> { return this._moduleype; }
|
||||||
|
|
||||||
create(parentInjector: Injector): NgModuleRef<T> {
|
create(parentInjector: Injector): NgModuleRef<T> {
|
||||||
if (!parentInjector) {
|
if (!parentInjector) {
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
|
|
||||||
import {Console} from '../console';
|
import {Console} from '../console';
|
||||||
import {Injectable} from '../di';
|
import {Injectable} from '../di';
|
||||||
import {Type, global, isString} from '../facade/lang';
|
import {global, isString} from '../facade/lang';
|
||||||
|
import {Type} from '../type';
|
||||||
import {ComponentFactory} from './component_factory';
|
import {ComponentFactory} from './component_factory';
|
||||||
import {ComponentResolver} from './component_resolver';
|
import {ComponentResolver} from './component_resolver';
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ const _SEPARATOR = '#';
|
||||||
export class SystemJsComponentResolver implements ComponentResolver {
|
export class SystemJsComponentResolver implements ComponentResolver {
|
||||||
constructor(private _resolver: ComponentResolver, private _console: Console) {}
|
constructor(private _resolver: ComponentResolver, private _console: Console) {}
|
||||||
|
|
||||||
resolveComponent(componentType: string|Type): Promise<ComponentFactory<any>> {
|
resolveComponent(componentType: string|Type<any>): Promise<ComponentFactory<any>> {
|
||||||
if (isString(componentType)) {
|
if (isString(componentType)) {
|
||||||
this._console.warn(ComponentResolver.LazyLoadingDeprecationMsg);
|
this._console.warn(ComponentResolver.LazyLoadingDeprecationMsg);
|
||||||
let [module, component] = componentType.split(_SEPARATOR);
|
let [module, component] = componentType.split(_SEPARATOR);
|
||||||
|
@ -60,7 +60,7 @@ const FACTORY_CLASS_SUFFIX = 'NgFactory';
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class SystemJsCmpFactoryResolver implements ComponentResolver {
|
export class SystemJsCmpFactoryResolver implements ComponentResolver {
|
||||||
constructor(private _console: Console) {}
|
constructor(private _console: Console) {}
|
||||||
resolveComponent(componentType: string|Type): Promise<ComponentFactory<any>> {
|
resolveComponent(componentType: string|Type<any>): Promise<ComponentFactory<any>> {
|
||||||
if (isString(componentType)) {
|
if (isString(componentType)) {
|
||||||
this._console.warn(ComponentResolver.LazyLoadingDeprecationMsg);
|
this._console.warn(ComponentResolver.LazyLoadingDeprecationMsg);
|
||||||
let [module, factory] = componentType.split(_SEPARATOR);
|
let [module, factory] = componentType.split(_SEPARATOR);
|
||||||
|
|
|
@ -11,14 +11,11 @@
|
||||||
* to be used by the decorator versions of these annotations.
|
* to be used by the decorator versions of these annotations.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {ChangeDetectionStrategy} from '../src/change_detection/change_detection';
|
|
||||||
import {Type} from '../src/facade/lang';
|
|
||||||
|
|
||||||
import {AnimationEntryMetadata} from './animation/metadata';
|
|
||||||
import {AttributeMetadata, ContentChildMetadata, ContentChildrenMetadata, QueryMetadata, ViewChildMetadata, ViewChildrenMetadata, ViewQueryMetadata} from './metadata/di';
|
import {AttributeMetadata, ContentChildMetadata, ContentChildrenMetadata, QueryMetadata, ViewChildMetadata, ViewChildrenMetadata, ViewQueryMetadata} from './metadata/di';
|
||||||
import {ComponentMetadata, ComponentMetadataType, DirectiveMetadata, DirectiveMetadataType, HostBindingMetadata, HostListenerMetadata, InputMetadata, OutputMetadata, PipeMetadata, PipeMetadataType} from './metadata/directives';
|
import {ComponentMetadata, ComponentMetadataType, DirectiveMetadata, DirectiveMetadataType, HostBindingMetadata, HostListenerMetadata, InputMetadata, OutputMetadata, PipeMetadata, PipeMetadataType} from './metadata/directives';
|
||||||
import {ModuleWithProviders, NgModuleMetadata, NgModuleMetadataType, SchemaMetadata} from './metadata/ng_module';
|
import {ModuleWithProviders, NgModuleMetadata, NgModuleMetadataType, SchemaMetadata} from './metadata/ng_module';
|
||||||
import {ViewEncapsulation} from './metadata/view';
|
import {ViewEncapsulation} from './metadata/view';
|
||||||
|
import {Type} from './type';
|
||||||
import {TypeDecorator, makeDecorator, makeParamDecorator, makePropDecorator} from './util/decorators';
|
import {TypeDecorator, makeDecorator, makeParamDecorator, makePropDecorator} from './util/decorators';
|
||||||
|
|
||||||
export {ANALYZE_FOR_ENTRY_COMPONENTS, AttributeMetadata, ContentChildMetadata, ContentChildrenMetadata, QueryMetadata, ViewChildMetadata, ViewChildrenMetadata, ViewQueryMetadata} from './metadata/di';
|
export {ANALYZE_FOR_ENTRY_COMPONENTS, AttributeMetadata, ContentChildMetadata, ContentChildrenMetadata, QueryMetadata, ViewChildMetadata, ViewChildrenMetadata, ViewQueryMetadata} from './metadata/di';
|
||||||
|
@ -28,6 +25,7 @@ export {CUSTOM_ELEMENTS_SCHEMA, ModuleWithProviders, NgModuleMetadata, NgModuleM
|
||||||
export {ViewEncapsulation, ViewMetadata} from './metadata/view';
|
export {ViewEncapsulation, ViewMetadata} from './metadata/view';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for the {@link DirectiveMetadata} decorator function.
|
* Interface for the {@link DirectiveMetadata} decorator function.
|
||||||
*
|
*
|
||||||
|
@ -218,10 +216,11 @@ export interface AttributeMetadataFactory {
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
export interface QueryMetadataFactory {
|
export interface QueryMetadataFactory {
|
||||||
(selector: Type|string,
|
(selector: Type<any>|Function|string,
|
||||||
{descendants, read}?: {descendants?: boolean, read?: any}): ParameterDecorator;
|
{descendants, read}?: {descendants?: boolean, read?: any}): ParameterDecorator;
|
||||||
new (selector: Type|string, {descendants, read}?: {descendants?: boolean, read?: any}):
|
new (
|
||||||
QueryMetadata;
|
selector: Type<any>|Function|string,
|
||||||
|
{descendants, read}?: {descendants?: boolean, read?: any}): QueryMetadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -229,9 +228,11 @@ export interface QueryMetadataFactory {
|
||||||
* @stable
|
* @stable
|
||||||
*/
|
*/
|
||||||
export interface ContentChildrenMetadataFactory {
|
export interface ContentChildrenMetadataFactory {
|
||||||
(selector: Type|string, {descendants, read}?: {descendants?: boolean, read?: any}): any;
|
(selector: Type<any>|Function|string,
|
||||||
new (selector: Type|string, {descendants, read}?: {descendants?: boolean, read?: any}):
|
{descendants, read}?: {descendants?: boolean, read?: any}): any;
|
||||||
ContentChildrenMetadata;
|
new (
|
||||||
|
selector: Type<any>|Function|string,
|
||||||
|
{descendants, read}?: {descendants?: boolean, read?: any}): ContentChildrenMetadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -239,8 +240,8 @@ export interface ContentChildrenMetadataFactory {
|
||||||
* @stable
|
* @stable
|
||||||
*/
|
*/
|
||||||
export interface ContentChildMetadataFactory {
|
export interface ContentChildMetadataFactory {
|
||||||
(selector: Type|string, {read}?: {read?: any}): any;
|
(selector: Type<any>|Function|string, {read}?: {read?: any}): any;
|
||||||
new (selector: Type|string, {read}?: {read?: any}): ContentChildMetadataFactory;
|
new (selector: Type<any>|Function|string, {read}?: {read?: any}): ContentChildMetadataFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -248,8 +249,8 @@ export interface ContentChildMetadataFactory {
|
||||||
* @stable
|
* @stable
|
||||||
*/
|
*/
|
||||||
export interface ViewChildrenMetadataFactory {
|
export interface ViewChildrenMetadataFactory {
|
||||||
(selector: Type|string, {read}?: {read?: any}): any;
|
(selector: Type<any>|Function|string, {read}?: {read?: any}): any;
|
||||||
new (selector: Type|string, {read}?: {read?: any}): ViewChildrenMetadata;
|
new (selector: Type<any>|Function|string, {read}?: {read?: any}): ViewChildrenMetadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -257,8 +258,8 @@ export interface ViewChildrenMetadataFactory {
|
||||||
* @stable
|
* @stable
|
||||||
*/
|
*/
|
||||||
export interface ViewChildMetadataFactory {
|
export interface ViewChildMetadataFactory {
|
||||||
(selector: Type|string, {read}?: {read?: any}): any;
|
(selector: Type<any>|Function|string, {read}?: {read?: any}): any;
|
||||||
new (selector: Type|string, {read}?: {read?: any}): ViewChildMetadataFactory;
|
new (selector: Type<any>|Function|string, {read}?: {read?: any}): ViewChildMetadataFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
import {resolveForwardRef} from '../di/forward_ref';
|
import {resolveForwardRef} from '../di/forward_ref';
|
||||||
import {DependencyMetadata} from '../di/metadata';
|
import {DependencyMetadata} from '../di/metadata';
|
||||||
import {OpaqueToken} from '../di/opaque_token';
|
import {OpaqueToken} from '../di/opaque_token';
|
||||||
import {StringWrapper, Type, isString, stringify} from '../facade/lang';
|
import {StringWrapper, isString, stringify} from '../facade/lang';
|
||||||
|
import {Type} from '../type';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This token can be used to create a virtual provider that will populate the
|
* This token can be used to create a virtual provider that will populate the
|
||||||
|
@ -199,11 +200,10 @@ export class QueryMetadata extends DependencyMetadata {
|
||||||
*/
|
*/
|
||||||
read: any;
|
read: any;
|
||||||
|
|
||||||
constructor(private _selector: Type|string, {descendants = false, first = false, read = null}: {
|
constructor(
|
||||||
descendants?: boolean,
|
private _selector: Type<any>|string,
|
||||||
first?: boolean,
|
{descendants = false, first = false,
|
||||||
read?: any
|
read = null}: {descendants?: boolean, first?: boolean, read?: any} = {}) {
|
||||||
} = {}) {
|
|
||||||
super();
|
super();
|
||||||
this.descendants = descendants;
|
this.descendants = descendants;
|
||||||
this.first = first;
|
this.first = first;
|
||||||
|
@ -258,7 +258,7 @@ export class QueryMetadata extends DependencyMetadata {
|
||||||
*/
|
*/
|
||||||
export class ContentChildrenMetadata extends QueryMetadata {
|
export class ContentChildrenMetadata extends QueryMetadata {
|
||||||
constructor(
|
constructor(
|
||||||
_selector: Type|string,
|
_selector: Type<any>|string,
|
||||||
{descendants = false, read = null}: {descendants?: boolean, read?: any} = {}) {
|
{descendants = false, read = null}: {descendants?: boolean, read?: any} = {}) {
|
||||||
super(_selector, {descendants: descendants, read: read});
|
super(_selector, {descendants: descendants, read: read});
|
||||||
}
|
}
|
||||||
|
@ -287,7 +287,7 @@ export class ContentChildrenMetadata extends QueryMetadata {
|
||||||
* @stable
|
* @stable
|
||||||
*/
|
*/
|
||||||
export class ContentChildMetadata extends QueryMetadata {
|
export class ContentChildMetadata extends QueryMetadata {
|
||||||
constructor(_selector: Type|string, {read = null}: {read?: any} = {}) {
|
constructor(_selector: Type<any>|string, {read = null}: {read?: any} = {}) {
|
||||||
super(_selector, {descendants: true, first: true, read: read});
|
super(_selector, {descendants: true, first: true, read: read});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -330,7 +330,7 @@ export class ContentChildMetadata extends QueryMetadata {
|
||||||
*/
|
*/
|
||||||
export class ViewQueryMetadata extends QueryMetadata {
|
export class ViewQueryMetadata extends QueryMetadata {
|
||||||
constructor(
|
constructor(
|
||||||
_selector: Type|string, {descendants = false, first = false, read = null}:
|
_selector: Type<any>|string, {descendants = false, first = false, read = null}:
|
||||||
{descendants?: boolean, first?: boolean, read?: any} = {}) {
|
{descendants?: boolean, first?: boolean, read?: any} = {}) {
|
||||||
super(_selector, {descendants: descendants, first: first, read: read});
|
super(_selector, {descendants: descendants, first: first, read: read});
|
||||||
}
|
}
|
||||||
|
@ -421,7 +421,7 @@ export class ViewQueryMetadata extends QueryMetadata {
|
||||||
* @stable
|
* @stable
|
||||||
*/
|
*/
|
||||||
export class ViewChildrenMetadata extends ViewQueryMetadata {
|
export class ViewChildrenMetadata extends ViewQueryMetadata {
|
||||||
constructor(_selector: Type|string, {read = null}: {read?: any} = {}) {
|
constructor(_selector: Type<any>|string, {read = null}: {read?: any} = {}) {
|
||||||
super(_selector, {descendants: true, read: read});
|
super(_selector, {descendants: true, read: read});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -498,7 +498,7 @@ export class ViewChildrenMetadata extends ViewQueryMetadata {
|
||||||
* @stable
|
* @stable
|
||||||
*/
|
*/
|
||||||
export class ViewChildMetadata extends ViewQueryMetadata {
|
export class ViewChildMetadata extends ViewQueryMetadata {
|
||||||
constructor(_selector: Type|string, {read = null}: {read?: any} = {}) {
|
constructor(_selector: Type<any>|string, {read = null}: {read?: any} = {}) {
|
||||||
super(_selector, {descendants: true, first: true, read: read});
|
super(_selector, {descendants: true, first: true, read: read});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
import {AnimationEntryMetadata} from '../animation/metadata';
|
import {AnimationEntryMetadata} from '../animation/metadata';
|
||||||
import {ChangeDetectionStrategy} from '../change_detection/constants';
|
import {ChangeDetectionStrategy} from '../change_detection/constants';
|
||||||
import {InjectableMetadata} from '../di/metadata';
|
import {InjectableMetadata} from '../di/metadata';
|
||||||
import {Type, isPresent} from '../facade/lang';
|
import {isPresent} from '../facade/lang';
|
||||||
|
import {Type} from '../type';
|
||||||
import {ViewEncapsulation} from './view';
|
import {ViewEncapsulation} from './view';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -792,11 +792,11 @@ export interface ComponentMetadataType extends DirectiveMetadataType {
|
||||||
styleUrls?: string[];
|
styleUrls?: string[];
|
||||||
styles?: string[];
|
styles?: string[];
|
||||||
animations?: AnimationEntryMetadata[];
|
animations?: AnimationEntryMetadata[];
|
||||||
directives?: Array<Type|any[]>;
|
directives?: Array<Type<any>|any[]>;
|
||||||
pipes?: Array<Type|any[]>;
|
pipes?: Array<Type<any>|any[]>;
|
||||||
encapsulation?: ViewEncapsulation;
|
encapsulation?: ViewEncapsulation;
|
||||||
interpolation?: [string, string];
|
interpolation?: [string, string];
|
||||||
entryComponents?: Array<Type|any[]>;
|
entryComponents?: Array<Type<any>|any[]>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1000,9 +1000,9 @@ export class ComponentMetadata extends DirectiveMetadata implements ComponentMet
|
||||||
*/
|
*/
|
||||||
animations: AnimationEntryMetadata[];
|
animations: AnimationEntryMetadata[];
|
||||||
|
|
||||||
directives: Array<Type|any[]>;
|
directives: Array<Type<any>|any[]>;
|
||||||
|
|
||||||
pipes: Array<Type|any[]>;
|
pipes: Array<Type<any>|any[]>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify how the template and the styles should be encapsulated.
|
* Specify how the template and the styles should be encapsulated.
|
||||||
|
@ -1020,7 +1020,7 @@ export class ComponentMetadata extends DirectiveMetadata implements ComponentMet
|
||||||
* Angular will create a {@link ComponentFactory ComponentFactory} and store it in the
|
* Angular will create a {@link ComponentFactory ComponentFactory} and store it in the
|
||||||
* {@link ComponentFactoryResolver ComponentFactoryResolver}.
|
* {@link ComponentFactoryResolver ComponentFactoryResolver}.
|
||||||
*/
|
*/
|
||||||
entryComponents: Array<Type|any[]>;
|
entryComponents: Array<Type<any>|any[]>;
|
||||||
|
|
||||||
constructor({selector,
|
constructor({selector,
|
||||||
inputs,
|
inputs,
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {InjectableMetadata} from '../di/metadata';
|
import {InjectableMetadata} from '../di/metadata';
|
||||||
import {Type} from '../facade/lang';
|
import {Type} from '../type';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A wrapper around a module that also includes the providers.
|
* A wrapper around a module that also includes the providers.
|
||||||
|
@ -15,7 +15,7 @@ import {Type} from '../facade/lang';
|
||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
export interface ModuleWithProviders {
|
export interface ModuleWithProviders {
|
||||||
ngModule: Type;
|
ngModule: Type<any>;
|
||||||
providers?: any[];
|
providers?: any[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,11 +42,11 @@ export const CUSTOM_ELEMENTS_SCHEMA: SchemaMetadata = {
|
||||||
*/
|
*/
|
||||||
export interface NgModuleMetadataType {
|
export interface NgModuleMetadataType {
|
||||||
providers?: any[];
|
providers?: any[];
|
||||||
declarations?: Array<Type|any[]>;
|
declarations?: Array<Type<any>|any[]>;
|
||||||
imports?: Array<Type|ModuleWithProviders|any[]>;
|
imports?: Array<Type<any>|ModuleWithProviders|any[]>;
|
||||||
exports?: Array<Type|any[]>;
|
exports?: Array<Type<any>|any[]>;
|
||||||
entryComponents?: Array<Type|any[]>;
|
entryComponents?: Array<Type<any>|any[]>;
|
||||||
bootstrap?: Array<Type|any[]>;
|
bootstrap?: Array<Type<any>|any[]>;
|
||||||
schemas?: Array<SchemaMetadata|any[]>;
|
schemas?: Array<SchemaMetadata|any[]>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ export class NgModuleMetadata extends InjectableMetadata implements NgModuleMeta
|
||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
declarations: Array<Type|any[]>;
|
declarations: Array<Type<any>|any[]>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies a list of modules whose exported directives/pipes
|
* Specifies a list of modules whose exported directives/pipes
|
||||||
|
@ -118,7 +118,7 @@ export class NgModuleMetadata extends InjectableMetadata implements NgModuleMeta
|
||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
imports: Array<Type|ModuleWithProviders|any[]>;
|
imports: Array<Type<any>|ModuleWithProviders|any[]>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies a list of directives/pipes/module that can be used within the template
|
* Specifies a list of directives/pipes/module that can be used within the template
|
||||||
|
@ -135,7 +135,7 @@ export class NgModuleMetadata extends InjectableMetadata implements NgModuleMeta
|
||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
exports: Array<Type|any[]>;
|
exports: Array<Type<any>|any[]>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the components that should be compiled as well when
|
* Defines the components that should be compiled as well when
|
||||||
|
@ -143,14 +143,14 @@ export class NgModuleMetadata extends InjectableMetadata implements NgModuleMeta
|
||||||
* Angular will create a {@link ComponentFactory ComponentFactory} and store it in the
|
* Angular will create a {@link ComponentFactory ComponentFactory} and store it in the
|
||||||
* {@link ComponentFactoryResolver ComponentFactoryResolver}.
|
* {@link ComponentFactoryResolver ComponentFactoryResolver}.
|
||||||
*/
|
*/
|
||||||
entryComponents: Array<Type|any[]>;
|
entryComponents: Array<Type<any>|any[]>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the components that should be bootstrapped when
|
* Defines the components that should be bootstrapped when
|
||||||
* this module is bootstrapped. The components listed here
|
* this module is bootstrapped. The components listed here
|
||||||
* will automatically be added to `entryComponents`.
|
* will automatically be added to `entryComponents`.
|
||||||
*/
|
*/
|
||||||
bootstrap: Array<Type|any[]>;
|
bootstrap: Array<Type<any>|any[]>;
|
||||||
|
|
||||||
schemas: Array<SchemaMetadata|any[]>;
|
schemas: Array<SchemaMetadata|any[]>;
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {AnimationEntryMetadata} from '../animation/metadata';
|
import {AnimationEntryMetadata} from '../animation/metadata';
|
||||||
import {Type} from '../facade/lang';
|
import {Type} from '../type';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -123,9 +123,9 @@ export class ViewMetadata {
|
||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
directives: Array<Type|any[]>;
|
directives: Array<Type<any>|any[]>;
|
||||||
|
|
||||||
pipes: Array<Type|any[]>;
|
pipes: Array<Type<any>|any[]>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify how the template and the styles should be encapsulated.
|
* Specify how the template and the styles should be encapsulated.
|
||||||
|
@ -144,8 +144,8 @@ export class ViewMetadata {
|
||||||
interpolation}: {
|
interpolation}: {
|
||||||
templateUrl?: string,
|
templateUrl?: string,
|
||||||
template?: string,
|
template?: string,
|
||||||
directives?: Array<Type|any[]>,
|
directives?: Array<Type<any>|any[]>,
|
||||||
pipes?: Array<Type|any[]>,
|
pipes?: Array<Type<any>|any[]>,
|
||||||
encapsulation?: ViewEncapsulation,
|
encapsulation?: ViewEncapsulation,
|
||||||
styles?: string[],
|
styles?: string[],
|
||||||
styleUrls?: string[],
|
styleUrls?: string[],
|
||||||
|
|
|
@ -6,20 +6,19 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Type} from '../src/facade/lang';
|
|
||||||
|
|
||||||
import {PlatformRef, PlatformRef_, createPlatformFactory} from './application_ref';
|
import {PlatformRef, PlatformRef_, createPlatformFactory} from './application_ref';
|
||||||
import {Console} from './console';
|
import {Console} from './console';
|
||||||
import {Provider} from './di';
|
import {Provider} from './di';
|
||||||
import {Reflector, reflector} from './reflection/reflection';
|
import {Reflector, reflector} from './reflection/reflection';
|
||||||
import {ReflectorReader} from './reflection/reflector_reader';
|
import {ReflectorReader} from './reflection/reflector_reader';
|
||||||
import {TestabilityRegistry} from './testability/testability';
|
import {TestabilityRegistry} from './testability/testability';
|
||||||
|
import {Type} from './type';
|
||||||
|
|
||||||
function _reflector(): Reflector {
|
function _reflector(): Reflector {
|
||||||
return reflector;
|
return reflector;
|
||||||
}
|
}
|
||||||
|
|
||||||
const _CORE_PLATFORM_PROVIDERS: Array<any|Type|Provider|any[]> = [
|
const _CORE_PLATFORM_PROVIDERS: Array<any|Type<any>|Provider|any[]> = [
|
||||||
PlatformRef_, {provide: PlatformRef, useExisting: PlatformRef_},
|
PlatformRef_, {provide: PlatformRef, useExisting: PlatformRef_},
|
||||||
{provide: Reflector, useFactory: _reflector, deps: []},
|
{provide: Reflector, useFactory: _reflector, deps: []},
|
||||||
{provide: ReflectorReader, useExisting: Reflector}, TestabilityRegistry, Console
|
{provide: ReflectorReader, useExisting: Reflector}, TestabilityRegistry, Console
|
||||||
|
|
|
@ -6,20 +6,19 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Type} from '../facade/lang';
|
import {Type} from '../type';
|
||||||
|
|
||||||
import {GetterFn, MethodFn, SetterFn} from './types';
|
import {GetterFn, MethodFn, SetterFn} from './types';
|
||||||
|
|
||||||
export interface PlatformReflectionCapabilities {
|
export interface PlatformReflectionCapabilities {
|
||||||
isReflectionEnabled(): boolean;
|
isReflectionEnabled(): boolean;
|
||||||
factory(type: Type): Function;
|
factory(type: Type<any>): Function;
|
||||||
interfaces(type: Type): any[];
|
interfaces(type: Type<any>): any[];
|
||||||
hasLifecycleHook(type: any, lcInterface: /*Type*/ any, lcProperty: string): boolean;
|
hasLifecycleHook(type: any, lcInterface: Type<any>, lcProperty: string): boolean;
|
||||||
parameters(type: any): any[][];
|
parameters(type: Type<any>): any[][];
|
||||||
annotations(type: any): any[];
|
annotations(type: Type<any>): any[];
|
||||||
propMetadata(typeOrFunc: any): {[key: string]: any[]};
|
propMetadata(typeOrFunc: Type<any>): {[key: string]: any[]};
|
||||||
getter(name: string): GetterFn;
|
getter(name: string): GetterFn;
|
||||||
setter(name: string): SetterFn;
|
setter(name: string): SetterFn;
|
||||||
method(name: string): MethodFn;
|
method(name: string): MethodFn;
|
||||||
importUri(type: any): string;
|
importUri(type: Type<any>): string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {BaseException} from '../facade/exceptions';
|
import {global, isFunction, isPresent, stringify} from '../facade/lang';
|
||||||
import {ConcreteType, Type, global, isFunction, isPresent, stringify} from '../facade/lang';
|
import {Type} from '../type';
|
||||||
|
|
||||||
import {PlatformReflectionCapabilities} from './platform_reflection_capabilities';
|
import {PlatformReflectionCapabilities} from './platform_reflection_capabilities';
|
||||||
import {GetterFn, MethodFn, SetterFn} from './types';
|
import {GetterFn, MethodFn, SetterFn} from './types';
|
||||||
|
@ -15,92 +15,17 @@ import {GetterFn, MethodFn, SetterFn} from './types';
|
||||||
export class ReflectionCapabilities implements PlatformReflectionCapabilities {
|
export class ReflectionCapabilities implements PlatformReflectionCapabilities {
|
||||||
private _reflect: any;
|
private _reflect: any;
|
||||||
|
|
||||||
constructor(reflect?: any) { this._reflect = isPresent(reflect) ? reflect : global.Reflect; }
|
constructor(reflect?: any) { this._reflect = reflect || global.Reflect; }
|
||||||
|
|
||||||
isReflectionEnabled(): boolean { return true; }
|
isReflectionEnabled(): boolean { return true; }
|
||||||
|
|
||||||
factory(t: ConcreteType<any>): Function {
|
factory(t: Type<any>): Function {
|
||||||
switch (t.length) {
|
var prototype = t.prototype;
|
||||||
case 0:
|
return function(...args: any[]) {
|
||||||
return () => new t();
|
var instance = Object.create(prototype);
|
||||||
case 1:
|
t.apply(instance, args);
|
||||||
return (a1: any) => new t(a1);
|
return instance;
|
||||||
case 2:
|
|
||||||
return (a1: any, a2: any) => new t(a1, a2);
|
|
||||||
case 3:
|
|
||||||
return (a1: any, a2: any, a3: any) => new t(a1, a2, a3);
|
|
||||||
case 4:
|
|
||||||
return (a1: any, a2: any, a3: any, a4: any) => new t(a1, a2, a3, a4);
|
|
||||||
case 5:
|
|
||||||
return (a1: any, a2: any, a3: any, a4: any, a5: any) => new t(a1, a2, a3, a4, a5);
|
|
||||||
case 6:
|
|
||||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any) =>
|
|
||||||
new t(a1, a2, a3, a4, a5, a6);
|
|
||||||
case 7:
|
|
||||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any, a7: any) =>
|
|
||||||
new t(a1, a2, a3, a4, a5, a6, a7);
|
|
||||||
case 8:
|
|
||||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any, a7: any, a8: any) =>
|
|
||||||
new t(a1, a2, a3, a4, a5, a6, a7, a8);
|
|
||||||
case 9:
|
|
||||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any, a7: any, a8: any, a9: any) =>
|
|
||||||
new t(a1, a2, a3, a4, a5, a6, a7, a8, a9);
|
|
||||||
case 10:
|
|
||||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any, a7: any, a8: any, a9: any,
|
|
||||||
a10: any) => new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
|
|
||||||
case 11:
|
|
||||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any, a7: any, a8: any, a9: any,
|
|
||||||
a10: any, a11: any) => new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
|
|
||||||
case 12:
|
|
||||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any, a7: any, a8: any, a9: any,
|
|
||||||
a10: any, a11: any, a12: any) =>
|
|
||||||
new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12);
|
|
||||||
case 13:
|
|
||||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any, a7: any, a8: any, a9: any,
|
|
||||||
a10: any, a11: any, a12: any, a13: any) =>
|
|
||||||
new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13);
|
|
||||||
case 14:
|
|
||||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any, a7: any, a8: any, a9: any,
|
|
||||||
a10: any, a11: any, a12: any, a13: any, a14: any) =>
|
|
||||||
new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14);
|
|
||||||
case 15:
|
|
||||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any, a7: any, a8: any, a9: any,
|
|
||||||
a10: any, a11: any, a12: any, a13: any, a14: any, a15: any) =>
|
|
||||||
new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15);
|
|
||||||
case 16:
|
|
||||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any, a7: any, a8: any, a9: any,
|
|
||||||
a10: any, a11: any, a12: any, a13: any, a14: any, a15: any, a16: any) =>
|
|
||||||
new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16);
|
|
||||||
case 17:
|
|
||||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any, a7: any, a8: any, a9: any,
|
|
||||||
a10: any, a11: any, a12: any, a13: any, a14: any, a15: any, a16: any, a17: any) =>
|
|
||||||
new t(
|
|
||||||
a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17);
|
|
||||||
case 18:
|
|
||||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any, a7: any, a8: any, a9: any,
|
|
||||||
a10: any, a11: any, a12: any, a13: any, a14: any, a15: any, a16: any, a17: any,
|
|
||||||
a18: any) =>
|
|
||||||
new t(
|
|
||||||
a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17,
|
|
||||||
a18);
|
|
||||||
case 19:
|
|
||||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any, a7: any, a8: any, a9: any,
|
|
||||||
a10: any, a11: any, a12: any, a13: any, a14: any, a15: any, a16: any, a17: any,
|
|
||||||
a18: any, a19: any) =>
|
|
||||||
new t(
|
|
||||||
a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17,
|
|
||||||
a18, a19);
|
|
||||||
case 20:
|
|
||||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any, a7: any, a8: any, a9: any,
|
|
||||||
a10: any, a11: any, a12: any, a13: any, a14: any, a15: any, a16: any, a17: any,
|
|
||||||
a18: any, a19: any, a20: any) =>
|
|
||||||
new t(
|
|
||||||
a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17,
|
|
||||||
a18, a19, a20);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
throw new Error(
|
|
||||||
`Cannot create a factory for '${stringify(t)}' because its constructor has more than 20 arguments`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
|
@ -132,7 +57,7 @@ export class ReflectionCapabilities implements PlatformReflectionCapabilities {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
parameters(typeOrFunc: Type): any[][] {
|
parameters(typeOrFunc: Type<any>): any[][] {
|
||||||
// Prefer the direct API.
|
// Prefer the direct API.
|
||||||
if (isPresent((<any>typeOrFunc).parameters)) {
|
if (isPresent((<any>typeOrFunc).parameters)) {
|
||||||
return (<any>typeOrFunc).parameters;
|
return (<any>typeOrFunc).parameters;
|
||||||
|
@ -163,7 +88,7 @@ export class ReflectionCapabilities implements PlatformReflectionCapabilities {
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
annotations(typeOrFunc: Type): any[] {
|
annotations(typeOrFunc: Type<any>): any[] {
|
||||||
// Prefer the direct API.
|
// Prefer the direct API.
|
||||||
if (isPresent((<any>typeOrFunc).annotations)) {
|
if (isPresent((<any>typeOrFunc).annotations)) {
|
||||||
var annotations = (<any>typeOrFunc).annotations;
|
var annotations = (<any>typeOrFunc).annotations;
|
||||||
|
@ -217,9 +142,9 @@ export class ReflectionCapabilities implements PlatformReflectionCapabilities {
|
||||||
// Note: JavaScript does not support to query for interfaces during runtime.
|
// Note: JavaScript does not support to query for interfaces during runtime.
|
||||||
// However, we can't throw here as the reflector will always call this method
|
// However, we can't throw here as the reflector will always call this method
|
||||||
// when asked for a lifecycle interface as this is what we check in Dart.
|
// when asked for a lifecycle interface as this is what we check in Dart.
|
||||||
interfaces(type: Type): any[] { return []; }
|
interfaces(type: Type<any>): any[] { return []; }
|
||||||
|
|
||||||
hasLifecycleHook(type: any, lcInterface: Type, lcProperty: string): boolean {
|
hasLifecycleHook(type: any, lcInterface: Type<any>, lcProperty: string): boolean {
|
||||||
if (!(type instanceof Type)) return false;
|
if (!(type instanceof Type)) return false;
|
||||||
|
|
||||||
var proto = (<any>type).prototype;
|
var proto = (<any>type).prototype;
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
|
|
||||||
import {Map, MapWrapper, Set, SetWrapper, StringMapWrapper} from '../facade/collection';
|
import {Map, MapWrapper, Set, SetWrapper, StringMapWrapper} from '../facade/collection';
|
||||||
import {BaseException} from '../facade/exceptions';
|
import {BaseException} from '../facade/exceptions';
|
||||||
import {Type, isPresent} from '../facade/lang';
|
import {isPresent} from '../facade/lang';
|
||||||
|
import {Type} from '../type';
|
||||||
import {PlatformReflectionCapabilities} from './platform_reflection_capabilities';
|
import {PlatformReflectionCapabilities} from './platform_reflection_capabilities';
|
||||||
import {ReflectorReader} from './reflector_reader';
|
import {ReflectorReader} from './reflector_reader';
|
||||||
import {GetterFn, MethodFn, SetterFn} from './types';
|
import {GetterFn, MethodFn, SetterFn} from './types';
|
||||||
|
@ -77,7 +77,7 @@ export class Reflector extends ReflectorReader {
|
||||||
this._injectableInfo.set(func, funcInfo);
|
this._injectableInfo.set(func, funcInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
registerType(type: Type, typeInfo: ReflectionInfo): void {
|
registerType(type: Type<any>, typeInfo: ReflectionInfo): void {
|
||||||
this._injectableInfo.set(type, typeInfo);
|
this._injectableInfo.set(type, typeInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ export class Reflector extends ReflectorReader {
|
||||||
|
|
||||||
registerMethods(methods: {[key: string]: MethodFn}): void { _mergeMaps(this._methods, methods); }
|
registerMethods(methods: {[key: string]: MethodFn}): void { _mergeMaps(this._methods, methods); }
|
||||||
|
|
||||||
factory(type: Type): Function {
|
factory(type: Type<any>): Function {
|
||||||
if (this._containsReflectionInfo(type)) {
|
if (this._containsReflectionInfo(type)) {
|
||||||
var res = this._getReflectionInfo(type).factory;
|
var res = this._getReflectionInfo(type).factory;
|
||||||
return isPresent(res) ? res : null;
|
return isPresent(res) ? res : null;
|
||||||
|
@ -96,7 +96,7 @@ export class Reflector extends ReflectorReader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
parameters(typeOrFunc: /*Type*/ any): any[][] {
|
parameters(typeOrFunc: Type<any>): any[][] {
|
||||||
if (this._injectableInfo.has(typeOrFunc)) {
|
if (this._injectableInfo.has(typeOrFunc)) {
|
||||||
var res = this._getReflectionInfo(typeOrFunc).parameters;
|
var res = this._getReflectionInfo(typeOrFunc).parameters;
|
||||||
return isPresent(res) ? res : [];
|
return isPresent(res) ? res : [];
|
||||||
|
@ -105,7 +105,7 @@ export class Reflector extends ReflectorReader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
annotations(typeOrFunc: /*Type*/ any): any[] {
|
annotations(typeOrFunc: Type<any>): any[] {
|
||||||
if (this._injectableInfo.has(typeOrFunc)) {
|
if (this._injectableInfo.has(typeOrFunc)) {
|
||||||
var res = this._getReflectionInfo(typeOrFunc).annotations;
|
var res = this._getReflectionInfo(typeOrFunc).annotations;
|
||||||
return isPresent(res) ? res : [];
|
return isPresent(res) ? res : [];
|
||||||
|
@ -114,7 +114,7 @@ export class Reflector extends ReflectorReader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
propMetadata(typeOrFunc: /*Type*/ any): {[key: string]: any[]} {
|
propMetadata(typeOrFunc: Type<any>): {[key: string]: any[]} {
|
||||||
if (this._injectableInfo.has(typeOrFunc)) {
|
if (this._injectableInfo.has(typeOrFunc)) {
|
||||||
var res = this._getReflectionInfo(typeOrFunc).propMetadata;
|
var res = this._getReflectionInfo(typeOrFunc).propMetadata;
|
||||||
return isPresent(res) ? res : {};
|
return isPresent(res) ? res : {};
|
||||||
|
@ -123,7 +123,7 @@ export class Reflector extends ReflectorReader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interfaces(type: /*Type*/ any): any[] {
|
interfaces(type: Type<any>): any[] {
|
||||||
if (this._injectableInfo.has(type)) {
|
if (this._injectableInfo.has(type)) {
|
||||||
var res = this._getReflectionInfo(type).interfaces;
|
var res = this._getReflectionInfo(type).interfaces;
|
||||||
return isPresent(res) ? res : [];
|
return isPresent(res) ? res : [];
|
||||||
|
@ -132,7 +132,7 @@ export class Reflector extends ReflectorReader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hasLifecycleHook(type: any, lcInterface: Type, lcProperty: string): boolean {
|
hasLifecycleHook(type: any, lcInterface: Type<any>, lcProperty: string): boolean {
|
||||||
var interfaces = this.interfaces(type);
|
var interfaces = this.interfaces(type);
|
||||||
if (interfaces.indexOf(lcInterface) !== -1) {
|
if (interfaces.indexOf(lcInterface) !== -1) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright Google Inc. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Use of this source code is governed by an MIT-style license that can be
|
||||||
|
* found in the LICENSE file at https://angular.io/license
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runtime representation a type that a Component or other object is instances of.
|
||||||
|
*
|
||||||
|
* An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by
|
||||||
|
* the `MyCustomComponent` constructor function.
|
||||||
|
*
|
||||||
|
* @stable
|
||||||
|
*/
|
||||||
|
export var Type = Function;
|
||||||
|
|
||||||
|
|
||||||
|
export interface Type<T> extends Function { new (...args: any[]): T; }
|
|
@ -6,7 +6,8 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {ConcreteType, Type, global, isFunction, stringify} from '../facade/lang';
|
import {global, isFunction, stringify} from '../facade/lang';
|
||||||
|
import {Type} from '../type';
|
||||||
|
|
||||||
var _nextClassId = 0;
|
var _nextClassId = 0;
|
||||||
|
|
||||||
|
@ -19,7 +20,7 @@ export interface ClassDefinition {
|
||||||
/**
|
/**
|
||||||
* Optional argument for specifying the superclass.
|
* Optional argument for specifying the superclass.
|
||||||
*/
|
*/
|
||||||
extends?: Type;
|
extends?: Type<any>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Required constructor function for a class.
|
* Required constructor function for a class.
|
||||||
|
@ -36,7 +37,7 @@ export interface ClassDefinition {
|
||||||
* Other methods on the class. Note that values should have type 'Function' but TS requires
|
* Other methods on the class. Note that values should have type 'Function' but TS requires
|
||||||
* all properties to have a narrower type than the index signature.
|
* all properties to have a narrower type than the index signature.
|
||||||
*/
|
*/
|
||||||
[x: string]: Type|Function|any[];
|
[x: string]: Type<any>|Function|any[];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -66,7 +67,7 @@ export interface TypeDecorator {
|
||||||
/**
|
/**
|
||||||
* Invoke as ES7 decorator.
|
* Invoke as ES7 decorator.
|
||||||
*/
|
*/
|
||||||
<T extends Type>(type: T): T;
|
<T extends Type<any>>(type: T): T;
|
||||||
|
|
||||||
// Make TypeDecorator assignable to built-in ParameterDecorator type.
|
// Make TypeDecorator assignable to built-in ParameterDecorator type.
|
||||||
// ParameterDecorator is declared in lib.d.ts as a `declare type`
|
// ParameterDecorator is declared in lib.d.ts as a `declare type`
|
||||||
|
@ -84,7 +85,7 @@ export interface TypeDecorator {
|
||||||
/**
|
/**
|
||||||
* Generate a class from the definition and annotate it with {@link TypeDecorator#annotations}.
|
* Generate a class from the definition and annotate it with {@link TypeDecorator#annotations}.
|
||||||
*/
|
*/
|
||||||
Class(obj: ClassDefinition): ConcreteType<any>;
|
Class(obj: ClassDefinition): Type<any>;
|
||||||
}
|
}
|
||||||
|
|
||||||
function extractAnnotation(annotation: any): any {
|
function extractAnnotation(annotation: any): any {
|
||||||
|
@ -219,7 +220,7 @@ function applyParams(fnOrArray: (Function | any[]), key: string): Function {
|
||||||
* ```
|
* ```
|
||||||
* @stable
|
* @stable
|
||||||
*/
|
*/
|
||||||
export function Class(clsDef: ClassDefinition): ConcreteType<any> {
|
export function Class(clsDef: ClassDefinition): Type<any> {
|
||||||
const constructor = applyParams(
|
const constructor = applyParams(
|
||||||
clsDef.hasOwnProperty('constructor') ? clsDef.constructor : undefined, 'constructor');
|
clsDef.hasOwnProperty('constructor') ? clsDef.constructor : undefined, 'constructor');
|
||||||
let proto = constructor.prototype;
|
let proto = constructor.prototype;
|
||||||
|
@ -246,7 +247,7 @@ export function Class(clsDef: ClassDefinition): ConcreteType<any> {
|
||||||
(constructor as any)['overriddenName'] = `class${_nextClassId++}`;
|
(constructor as any)['overriddenName'] = `class${_nextClassId++}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return <ConcreteType<any>>constructor;
|
return <Type<any>>constructor;
|
||||||
}
|
}
|
||||||
|
|
||||||
var Reflect = global.Reflect;
|
var Reflect = global.Reflect;
|
||||||
|
@ -268,7 +269,7 @@ export function makeDecorator(annotationCls: any, chainFn: (fn: Function) => voi
|
||||||
const chainAnnotation =
|
const chainAnnotation =
|
||||||
isFunction(this) && this.annotations instanceof Array ? this.annotations : [];
|
isFunction(this) && this.annotations instanceof Array ? this.annotations : [];
|
||||||
chainAnnotation.push(annotationInstance);
|
chainAnnotation.push(annotationInstance);
|
||||||
const TypeDecorator: TypeDecorator = <TypeDecorator>function TypeDecorator(cls: Type) {
|
const TypeDecorator: TypeDecorator = <TypeDecorator>function TypeDecorator(cls: Type<any>) {
|
||||||
const annotations = Reflect.getOwnMetadata('annotations', cls) || [];
|
const annotations = Reflect.getOwnMetadata('annotations', cls) || [];
|
||||||
annotations.push(annotationInstance);
|
annotations.push(annotationInstance);
|
||||||
Reflect.defineMetadata('annotations', annotations, cls);
|
Reflect.defineMetadata('annotations', annotations, cls);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {APP_BOOTSTRAP_LISTENER, APP_INITIALIZER, ChangeDetectorRef, CompilerFactory, Component, Injector, NgModule, PlatformRef} from '@angular/core';
|
import {APP_BOOTSTRAP_LISTENER, APP_INITIALIZER, ChangeDetectorRef, CompilerFactory, Component, Injector, NgModule, PlatformRef, Type} from '@angular/core';
|
||||||
import {ApplicationRef, ApplicationRef_} from '@angular/core/src/application_ref';
|
import {ApplicationRef, ApplicationRef_} from '@angular/core/src/application_ref';
|
||||||
import {Console} from '@angular/core/src/console';
|
import {Console} from '@angular/core/src/console';
|
||||||
import {ComponentRef} from '@angular/core/src/linker/component_factory';
|
import {ComponentRef} from '@angular/core/src/linker/component_factory';
|
||||||
|
@ -17,7 +17,6 @@ import {expect} from '@angular/platform-browser/testing/matchers';
|
||||||
|
|
||||||
import {ExceptionHandler} from '../src/facade/exception_handler';
|
import {ExceptionHandler} from '../src/facade/exception_handler';
|
||||||
import {BaseException} from '../src/facade/exceptions';
|
import {BaseException} from '../src/facade/exceptions';
|
||||||
import {ConcreteType} from '../src/facade/lang';
|
|
||||||
import {TestBed, async, inject, withModule} from '../testing';
|
import {TestBed, async, inject, withModule} from '../testing';
|
||||||
|
|
||||||
import {SpyChangeDetectorRef} from './spies';
|
import {SpyChangeDetectorRef} from './spies';
|
||||||
|
@ -40,9 +39,9 @@ export function main() {
|
||||||
|
|
||||||
type CreateModuleOptions = {providers?: any[], ngDoBootstrap?: any, bootstrap?: any[]};
|
type CreateModuleOptions = {providers?: any[], ngDoBootstrap?: any, bootstrap?: any[]};
|
||||||
|
|
||||||
function createModule(providers?: any[]): ConcreteType<any>;
|
function createModule(providers?: any[]): Type<any>;
|
||||||
function createModule(options: CreateModuleOptions): ConcreteType<any>;
|
function createModule(options: CreateModuleOptions): Type<any>;
|
||||||
function createModule(providersOrOptions: any[] | CreateModuleOptions): ConcreteType<any> {
|
function createModule(providersOrOptions: any[] | CreateModuleOptions): Type<any> {
|
||||||
let options: CreateModuleOptions = {};
|
let options: CreateModuleOptions = {};
|
||||||
if (providersOrOptions instanceof Array) {
|
if (providersOrOptions instanceof Array) {
|
||||||
options = {providers: providersOrOptions};
|
options = {providers: providersOrOptions};
|
||||||
|
|
|
@ -6,11 +6,10 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import {Type} from '@angular/core';
|
||||||
import {forwardRef, resolveForwardRef} from '@angular/core/src/di';
|
import {forwardRef, resolveForwardRef} from '@angular/core/src/di';
|
||||||
import {beforeEach, ddescribe, describe, expect, iit, inject, it, xit} from '@angular/core/testing/testing_internal';
|
import {beforeEach, ddescribe, describe, expect, iit, inject, it, xit} from '@angular/core/testing/testing_internal';
|
||||||
|
|
||||||
import {Type} from '../../src/facade/lang';
|
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
describe('forwardRef', function() {
|
describe('forwardRef', function() {
|
||||||
it('should wrap and unwrap the reference', () => {
|
it('should wrap and unwrap the reference', () => {
|
||||||
|
|
|
@ -10,7 +10,7 @@ import {AsyncPipe, NgFor} from '@angular/common';
|
||||||
import {ElementSchemaRegistry} from '@angular/compiler/src/schema/element_schema_registry';
|
import {ElementSchemaRegistry} from '@angular/compiler/src/schema/element_schema_registry';
|
||||||
import {TEST_COMPILER_PROVIDERS} from '@angular/compiler/test/test_bindings';
|
import {TEST_COMPILER_PROVIDERS} from '@angular/compiler/test/test_bindings';
|
||||||
import {MockSchemaRegistry} from '@angular/compiler/testing';
|
import {MockSchemaRegistry} from '@angular/compiler/testing';
|
||||||
import {AfterContentChecked, AfterContentInit, AfterViewChecked, AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, DebugElement, Directive, DoCheck, Injectable, Input, OnChanges, OnDestroy, OnInit, Output, Pipe, PipeTransform, RenderComponentType, Renderer, RootRenderer, SimpleChange, SimpleChanges, TemplateRef, ViewContainerRef, ViewMetadata, WrappedValue, forwardRef} from '@angular/core';
|
import {AfterContentChecked, AfterContentInit, AfterViewChecked, AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, DebugElement, Directive, DoCheck, Injectable, Input, OnChanges, OnDestroy, OnInit, Output, Pipe, PipeTransform, RenderComponentType, Renderer, RootRenderer, SimpleChange, SimpleChanges, TemplateRef, Type, ViewContainerRef, ViewMetadata, WrappedValue, forwardRef} from '@angular/core';
|
||||||
import {DebugDomRenderer} from '@angular/core/src/debug/debug_renderer';
|
import {DebugDomRenderer} from '@angular/core/src/debug/debug_renderer';
|
||||||
import {ComponentFixture, TestBed, TestComponentBuilder, fakeAsync, flushMicrotasks, tick} from '@angular/core/testing';
|
import {ComponentFixture, TestBed, TestComponentBuilder, fakeAsync, flushMicrotasks, tick} from '@angular/core/testing';
|
||||||
import {afterEach, beforeEach, beforeEachProviders, ddescribe, describe, expect, iit, inject, it, xit} from '@angular/core/testing/testing_internal';
|
import {afterEach, beforeEach, beforeEachProviders, ddescribe, describe, expect, iit, inject, it, xit} from '@angular/core/testing/testing_internal';
|
||||||
|
@ -21,7 +21,7 @@ import {DomRootRenderer} from '@angular/platform-browser/src/dom/dom_renderer';
|
||||||
import {EventEmitter} from '../../src/facade/async';
|
import {EventEmitter} from '../../src/facade/async';
|
||||||
import {StringMapWrapper} from '../../src/facade/collection';
|
import {StringMapWrapper} from '../../src/facade/collection';
|
||||||
import {BaseException} from '../../src/facade/exceptions';
|
import {BaseException} from '../../src/facade/exceptions';
|
||||||
import {ConcreteType, NumberWrapper, Type, isBlank} from '../../src/facade/lang';
|
import {NumberWrapper, isBlank} from '../../src/facade/lang';
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
let tcb: TestComponentBuilder;
|
let tcb: TestComponentBuilder;
|
||||||
|
@ -30,11 +30,11 @@ export function main() {
|
||||||
let directiveLog: DirectiveLog;
|
let directiveLog: DirectiveLog;
|
||||||
|
|
||||||
function createCompFixture<T>(template: string): ComponentFixture<TestComponent>;
|
function createCompFixture<T>(template: string): ComponentFixture<TestComponent>;
|
||||||
function createCompFixture<T>(template: string, compType: ConcreteType<T>): ComponentFixture<T>;
|
function createCompFixture<T>(template: string, compType: Type<T>): ComponentFixture<T>;
|
||||||
function createCompFixture<T>(
|
function createCompFixture<T>(
|
||||||
template: string, compType: ConcreteType<T>, _tcb: TestComponentBuilder): ComponentFixture<T>;
|
template: string, compType: Type<T>, _tcb: TestComponentBuilder): ComponentFixture<T>;
|
||||||
function createCompFixture<T>(
|
function createCompFixture<T>(
|
||||||
template: string, compType: ConcreteType<T> = <any>TestComponent,
|
template: string, compType: Type<T> = <any>TestComponent,
|
||||||
_tcb: TestComponentBuilder = null): ComponentFixture<T> {
|
_tcb: TestComponentBuilder = null): ComponentFixture<T> {
|
||||||
if (isBlank(_tcb)) {
|
if (isBlank(_tcb)) {
|
||||||
_tcb = tcb;
|
_tcb = tcb;
|
||||||
|
@ -46,28 +46,28 @@ export function main() {
|
||||||
.createFakeAsync(compType);
|
.createFakeAsync(compType);
|
||||||
}
|
}
|
||||||
|
|
||||||
function queryDirs(el: DebugElement, dirType: Type): any {
|
function queryDirs(el: DebugElement, dirType: Type<any>): any {
|
||||||
var nodes = el.queryAllNodes(By.directive(dirType));
|
var nodes = el.queryAllNodes(By.directive(dirType));
|
||||||
return nodes.map(node => node.injector.get(dirType));
|
return nodes.map(node => node.injector.get(dirType));
|
||||||
}
|
}
|
||||||
|
|
||||||
function _bindSimpleProp<T>(bindAttr: string): ComponentFixture<TestComponent>;
|
function _bindSimpleProp<T>(bindAttr: string): ComponentFixture<TestComponent>;
|
||||||
function _bindSimpleProp<T>(bindAttr: string, compType: ConcreteType<T>): ComponentFixture<T>;
|
function _bindSimpleProp<T>(bindAttr: string, compType: Type<T>): ComponentFixture<T>;
|
||||||
function _bindSimpleProp<T>(
|
function _bindSimpleProp<T>(
|
||||||
bindAttr: string, compType: ConcreteType<T> = <any>TestComponent): ComponentFixture<T> {
|
bindAttr: string, compType: Type<T> = <any>TestComponent): ComponentFixture<T> {
|
||||||
var template = `<div ${bindAttr}></div>`;
|
var template = `<div ${bindAttr}></div>`;
|
||||||
return createCompFixture(template, compType);
|
return createCompFixture(template, compType);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _bindSimpleValue(expression: any): ComponentFixture<TestComponent>;
|
function _bindSimpleValue(expression: any): ComponentFixture<TestComponent>;
|
||||||
function _bindSimpleValue<T>(expression: any, compType: ConcreteType<T>): ComponentFixture<T>;
|
function _bindSimpleValue<T>(expression: any, compType: Type<T>): ComponentFixture<T>;
|
||||||
function _bindSimpleValue<T>(
|
function _bindSimpleValue<T>(
|
||||||
expression: any, compType: ConcreteType<T> = <any>TestComponent): ComponentFixture<T> {
|
expression: any, compType: Type<T> = <any>TestComponent): ComponentFixture<T> {
|
||||||
return _bindSimpleProp(`[someProp]='${expression}'`, compType);
|
return _bindSimpleProp(`[someProp]='${expression}'`, compType);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _bindAndCheckSimpleValue(
|
function _bindAndCheckSimpleValue(
|
||||||
expression: any, compType: ConcreteType<any> = TestComponent): string[] {
|
expression: any, compType: Type<any> = TestComponent): string[] {
|
||||||
const ctx = _bindSimpleValue(expression, compType);
|
const ctx = _bindSimpleValue(expression, compType);
|
||||||
ctx.detectChanges(false);
|
ctx.detectChanges(false);
|
||||||
return renderLog.log;
|
return renderLog.log;
|
||||||
|
|
|
@ -212,7 +212,7 @@ function createRootElement(doc: any, name: string): any {
|
||||||
return rootEl;
|
return rootEl;
|
||||||
}
|
}
|
||||||
|
|
||||||
function filterByDirective(type: Type): Predicate<DebugElement> {
|
function filterByDirective(type: Type<any>): Predicate<DebugElement> {
|
||||||
return (debugElement) => { return debugElement.providerTokens.indexOf(type) !== -1; };
|
return (debugElement) => { return debugElement.providerTokens.indexOf(type) !== -1; };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,14 +9,14 @@
|
||||||
import {LowerCasePipe, NgIf} from '@angular/common';
|
import {LowerCasePipe, NgIf} from '@angular/common';
|
||||||
import {CompilerConfig, NgModuleResolver} from '@angular/compiler';
|
import {CompilerConfig, NgModuleResolver} from '@angular/compiler';
|
||||||
import {MockNgModuleResolver} from '@angular/compiler/testing';
|
import {MockNgModuleResolver} from '@angular/compiler/testing';
|
||||||
import {ANALYZE_FOR_ENTRY_COMPONENTS, CUSTOM_ELEMENTS_SCHEMA, Compiler, Component, ComponentFactoryResolver, ComponentRef, ComponentResolver, DebugElement, Directive, Host, HostBinding, Inject, Injectable, Injector, Input, ModuleWithProviders, NgModule, NgModuleMetadata, NgModuleRef, OpaqueToken, Optional, Pipe, Provider, ReflectiveInjector, SelfMetadata, SkipSelf, SkipSelfMetadata, ViewMetadata, forwardRef, getDebugNode, provide} from '@angular/core';
|
import {ANALYZE_FOR_ENTRY_COMPONENTS, CUSTOM_ELEMENTS_SCHEMA, Compiler, Component, ComponentFactoryResolver, ComponentResolver, Directive, HostBinding, Inject, Injectable, Injector, Input, NgModule, NgModuleRef, Optional, Pipe, ReflectiveInjector, SelfMetadata, Type, forwardRef, provide} from '@angular/core';
|
||||||
import {Console} from '@angular/core/src/console';
|
import {Console} from '@angular/core/src/console';
|
||||||
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||||
import {AsyncTestCompleter, beforeEach, beforeEachProviders, ddescribe, describe, iit, inject, it, xdescribe, xit} from '@angular/core/testing/testing_internal';
|
import {AsyncTestCompleter, beforeEach, beforeEachProviders, ddescribe, describe, iit, inject, it, xdescribe, xit} from '@angular/core/testing/testing_internal';
|
||||||
import {expect} from '@angular/platform-browser/testing/matchers';
|
import {expect} from '@angular/platform-browser/testing/matchers';
|
||||||
|
|
||||||
import {BaseException} from '../../src/facade/exceptions';
|
import {BaseException} from '../../src/facade/exceptions';
|
||||||
import {ConcreteType, Type, stringify} from '../../src/facade/lang';
|
import {stringify} from '../../src/facade/lang';
|
||||||
import {NgModuleInjector} from '../../src/linker/ng_module_factory';
|
import {NgModuleInjector} from '../../src/linker/ng_module_factory';
|
||||||
|
|
||||||
class Engine {}
|
class Engine {}
|
||||||
|
@ -128,13 +128,11 @@ function declareTests({useJit}: {useJit: boolean}) {
|
||||||
injector = _injector;
|
injector = _injector;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
function createModule<T>(
|
function createModule<T>(moduleType: Type<T>, parentInjector: Injector = null): NgModuleRef<T> {
|
||||||
moduleType: ConcreteType<T>, parentInjector: Injector = null): NgModuleRef<T> {
|
|
||||||
return compiler.compileModuleSync(moduleType).create(parentInjector);
|
return compiler.compileModuleSync(moduleType).create(parentInjector);
|
||||||
}
|
}
|
||||||
|
|
||||||
function createComp<T>(
|
function createComp<T>(compType: Type<T>, moduleType: Type<any>): ComponentFixture<T> {
|
||||||
compType: ConcreteType<T>, moduleType: ConcreteType<any>): ComponentFixture<T> {
|
|
||||||
let ngModule = createModule(moduleType);
|
let ngModule = createModule(moduleType);
|
||||||
var cf = ngModule.componentFactoryResolver.resolveComponentFactory(compType);
|
var cf = ngModule.componentFactoryResolver.resolveComponentFactory(compType);
|
||||||
return new ComponentFixture(cf.create(injector), null, false);
|
return new ComponentFixture(cf.create(injector), null, false);
|
||||||
|
|
|
@ -13,7 +13,7 @@ import {beforeEach, beforeEachProviders, ddescribe, describe, iit, inject, it, x
|
||||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||||
import {expect} from '@angular/platform-browser/testing/matchers';
|
import {expect} from '@angular/platform-browser/testing/matchers';
|
||||||
|
|
||||||
import {ConcreteType, isBlank} from '../../src/facade/lang';
|
import {isBlank} from '../../src/facade/lang';
|
||||||
|
|
||||||
const ALL_DIRECTIVES = [
|
const ALL_DIRECTIVES = [
|
||||||
forwardRef(() => SimpleDirective),
|
forwardRef(() => SimpleDirective),
|
||||||
|
@ -244,8 +244,7 @@ export function main() {
|
||||||
var tcb: TestComponentBuilder;
|
var tcb: TestComponentBuilder;
|
||||||
|
|
||||||
function createCompFixture<T>(
|
function createCompFixture<T>(
|
||||||
template: string, tcb: TestComponentBuilder,
|
template: string, tcb: TestComponentBuilder, comp: Type<T> = null): ComponentFixture<T> {
|
||||||
comp: ConcreteType<T> = null): ComponentFixture<T> {
|
|
||||||
if (isBlank(comp)) {
|
if (isBlank(comp)) {
|
||||||
comp = <any>TestComp;
|
comp = <any>TestComp;
|
||||||
}
|
}
|
||||||
|
@ -257,7 +256,7 @@ export function main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function createComp(
|
function createComp(
|
||||||
template: string, tcb: TestComponentBuilder, comp: ConcreteType<any> = null): DebugElement {
|
template: string, tcb: TestComponentBuilder, comp: Type<any> = null): DebugElement {
|
||||||
var fixture = createCompFixture(template, tcb, comp);
|
var fixture = createCompFixture(template, tcb, comp);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
return fixture.debugElement;
|
return fixture.debugElement;
|
||||||
|
|
|
@ -23,7 +23,7 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create type in ES5', () => {
|
it('should create type in ES5', () => {
|
||||||
function MyComponent(){};
|
class MyComponent {};
|
||||||
var as: any /** TODO #9100 */;
|
var as: any /** TODO #9100 */;
|
||||||
(<any>MyComponent).annotations = as = Component({});
|
(<any>MyComponent).annotations = as = Component({});
|
||||||
expect(reflector.annotations(MyComponent)).toEqual(as.annotations);
|
expect(reflector.annotations(MyComponent)).toEqual(as.annotations);
|
||||||
|
|
|
@ -141,9 +141,6 @@ export function main() {
|
||||||
// clang-format on
|
// clang-format on
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw when more than 20 arguments',
|
|
||||||
() => { expect(() => reflector.factory(TestObjWith21Args)).toThrowError(); });
|
|
||||||
|
|
||||||
it('should return a registered factory if available', () => {
|
it('should return a registered factory if available', () => {
|
||||||
reflector.registerType(TestObj, new ReflectionInfo(null, null, () => 'fake'));
|
reflector.registerType(TestObj, new ReflectionInfo(null, null, () => 'fake'));
|
||||||
expect(reflector.factory(TestObj)()).toEqual('fake');
|
expect(reflector.factory(TestObj)()).toEqual('fake');
|
||||||
|
|
|
@ -32,5 +32,5 @@ export class MockApplicationRef extends ApplicationRef {
|
||||||
|
|
||||||
tick(): void {}
|
tick(): void {}
|
||||||
|
|
||||||
get componentTypes(): Type[] { return null; };
|
get componentTypes(): Type<any>[] { return null; };
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {CompilerOptions, ComponentFactory, ComponentMetadataType, ComponentStillLoadingError, DirectiveMetadataType, Injector, ModuleWithComponentFactories, NgModule, NgModuleFactory, NgModuleMetadataType, NgModuleRef, NgZone, OpaqueToken, PipeMetadataType, PlatformRef, Provider, ReflectiveInjector, SchemaMetadata, Type, assertPlatform, createPlatform, getPlatform} from '../index';
|
import {CompilerOptions, ComponentFactory, ComponentMetadataType, ComponentStillLoadingError, DirectiveMetadataType, Injector, ModuleWithComponentFactories, NgModule, NgModuleFactory, NgModuleMetadataType, NgModuleRef, NgZone, OpaqueToken, PipeMetadataType, PlatformRef, Provider, ReflectiveInjector, SchemaMetadata, assertPlatform, createPlatform, getPlatform} from '../index';
|
||||||
import {ListWrapper} from '../src/facade/collection';
|
import {ListWrapper} from '../src/facade/collection';
|
||||||
import {BaseException} from '../src/facade/exceptions';
|
import {BaseException} from '../src/facade/exceptions';
|
||||||
import {ConcreteType, FunctionWrapper, isPresent, stringify} from '../src/facade/lang';
|
import {FunctionWrapper, isPresent, stringify} from '../src/facade/lang';
|
||||||
|
import {Type} from '../src/type';
|
||||||
import {AsyncTestCompleter} from './async_test_completer';
|
import {AsyncTestCompleter} from './async_test_completer';
|
||||||
import {ComponentFixture} from './component_fixture';
|
import {ComponentFixture} from './component_fixture';
|
||||||
import {MetadataOverride} from './metadata_override';
|
import {MetadataOverride} from './metadata_override';
|
||||||
|
@ -63,7 +63,7 @@ export class TestBed implements Injector {
|
||||||
*
|
*
|
||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
static initTestEnvironment(ngModule: Type, platform: PlatformRef): TestBed {
|
static initTestEnvironment(ngModule: Type<any>, platform: PlatformRef): TestBed {
|
||||||
const testBed = getTestBed();
|
const testBed = getTestBed();
|
||||||
getTestBed().initTestEnvironment(ngModule, platform);
|
getTestBed().initTestEnvironment(ngModule, platform);
|
||||||
return testBed;
|
return testBed;
|
||||||
|
@ -106,34 +106,31 @@ export class TestBed implements Injector {
|
||||||
*/
|
*/
|
||||||
static compileComponents(): Promise<any> { return getTestBed().compileComponents(); }
|
static compileComponents(): Promise<any> { return getTestBed().compileComponents(); }
|
||||||
|
|
||||||
static overrideModule(
|
static overrideModule(ngModule: Type<any>, override: MetadataOverride<NgModuleMetadataType>):
|
||||||
ngModule: ConcreteType<any>,
|
typeof TestBed {
|
||||||
override: MetadataOverride<NgModuleMetadataType>): typeof TestBed {
|
|
||||||
getTestBed().overrideModule(ngModule, override);
|
getTestBed().overrideModule(ngModule, override);
|
||||||
return TestBed;
|
return TestBed;
|
||||||
}
|
}
|
||||||
|
|
||||||
static overrideComponent(
|
static overrideComponent(component: Type<any>, override: MetadataOverride<ComponentMetadataType>):
|
||||||
component: ConcreteType<any>,
|
typeof TestBed {
|
||||||
override: MetadataOverride<ComponentMetadataType>): typeof TestBed {
|
|
||||||
getTestBed().overrideComponent(component, override);
|
getTestBed().overrideComponent(component, override);
|
||||||
return TestBed;
|
return TestBed;
|
||||||
}
|
}
|
||||||
|
|
||||||
static overrideDirective(
|
static overrideDirective(directive: Type<any>, override: MetadataOverride<DirectiveMetadataType>):
|
||||||
directive: ConcreteType<any>,
|
typeof TestBed {
|
||||||
override: MetadataOverride<DirectiveMetadataType>): typeof TestBed {
|
|
||||||
getTestBed().overrideDirective(directive, override);
|
getTestBed().overrideDirective(directive, override);
|
||||||
return TestBed;
|
return TestBed;
|
||||||
}
|
}
|
||||||
|
|
||||||
static overridePipe(pipe: ConcreteType<any>, override: MetadataOverride<PipeMetadataType>):
|
static overridePipe(pipe: Type<any>, override: MetadataOverride<PipeMetadataType>):
|
||||||
typeof TestBed {
|
typeof TestBed {
|
||||||
getTestBed().overridePipe(pipe, override);
|
getTestBed().overridePipe(pipe, override);
|
||||||
return TestBed;
|
return TestBed;
|
||||||
}
|
}
|
||||||
|
|
||||||
static createComponent<T>(component: ConcreteType<T>): ComponentFixture<T> {
|
static createComponent<T>(component: Type<T>): ComponentFixture<T> {
|
||||||
return getTestBed().createComponent(component);
|
return getTestBed().createComponent(component);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,14 +142,14 @@ export class TestBed implements Injector {
|
||||||
|
|
||||||
private _compilerOptions: CompilerOptions[] = [];
|
private _compilerOptions: CompilerOptions[] = [];
|
||||||
|
|
||||||
private _moduleOverrides: [ConcreteType<any>, MetadataOverride<NgModuleMetadataType>][] = [];
|
private _moduleOverrides: [Type<any>, MetadataOverride<NgModuleMetadataType>][] = [];
|
||||||
private _componentOverrides: [ConcreteType<any>, MetadataOverride<ComponentMetadataType>][] = [];
|
private _componentOverrides: [Type<any>, MetadataOverride<ComponentMetadataType>][] = [];
|
||||||
private _directiveOverrides: [ConcreteType<any>, MetadataOverride<DirectiveMetadataType>][] = [];
|
private _directiveOverrides: [Type<any>, MetadataOverride<DirectiveMetadataType>][] = [];
|
||||||
private _pipeOverrides: [ConcreteType<any>, MetadataOverride<PipeMetadataType>][] = [];
|
private _pipeOverrides: [Type<any>, MetadataOverride<PipeMetadataType>][] = [];
|
||||||
|
|
||||||
private _providers: Array<Type|Provider|any[]|any> = [];
|
private _providers: Array<Type<any>|Provider|any[]|any> = [];
|
||||||
private _declarations: Array<Type|any[]|any> = [];
|
private _declarations: Array<Type<any>|any[]|any> = [];
|
||||||
private _imports: Array<Type|any[]|any> = [];
|
private _imports: Array<Type<any>|any[]|any> = [];
|
||||||
private _schemas: Array<SchemaMetadata|any[]> = [];
|
private _schemas: Array<SchemaMetadata|any[]> = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -168,7 +165,7 @@ export class TestBed implements Injector {
|
||||||
*
|
*
|
||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
initTestEnvironment(ngModule: Type, platform: PlatformRef) {
|
initTestEnvironment(ngModule: Type<any>, platform: PlatformRef) {
|
||||||
if (this.platform || this.ngModule) {
|
if (this.platform || this.ngModule) {
|
||||||
throw new BaseException('Cannot set base providers because it has already been called');
|
throw new BaseException('Cannot set base providers because it has already been called');
|
||||||
}
|
}
|
||||||
|
@ -211,7 +208,7 @@ export class TestBed implements Injector {
|
||||||
|
|
||||||
platform: PlatformRef = null;
|
platform: PlatformRef = null;
|
||||||
|
|
||||||
ngModule: Type = null;
|
ngModule: Type<any> = null;
|
||||||
|
|
||||||
configureCompiler(config: {providers?: any[], useJit?: boolean}) {
|
configureCompiler(config: {providers?: any[], useJit?: boolean}) {
|
||||||
this._assertNotInstantiated('TestBed.configureCompiler', 'configure the compiler');
|
this._assertNotInstantiated('TestBed.configureCompiler', 'configure the compiler');
|
||||||
|
@ -270,7 +267,7 @@ export class TestBed implements Injector {
|
||||||
this._instantiated = true;
|
this._instantiated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _createCompilerAndModule(): ConcreteType<any> {
|
private _createCompilerAndModule(): Type<any> {
|
||||||
const providers = this._providers.concat([{provide: TestBed, useValue: this}]);
|
const providers = this._providers.concat([{provide: TestBed, useValue: this}]);
|
||||||
const declarations = this._declarations;
|
const declarations = this._declarations;
|
||||||
const imports = [this.ngModule, this._imports];
|
const imports = [this.ngModule, this._imports];
|
||||||
|
@ -319,30 +316,27 @@ export class TestBed implements Injector {
|
||||||
return FunctionWrapper.apply(fn, params);
|
return FunctionWrapper.apply(fn, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
overrideModule(ngModule: ConcreteType<any>, override: MetadataOverride<NgModuleMetadataType>):
|
overrideModule(ngModule: Type<any>, override: MetadataOverride<NgModuleMetadataType>): void {
|
||||||
void {
|
|
||||||
this._assertNotInstantiated('overrideModule', 'override module metadata');
|
this._assertNotInstantiated('overrideModule', 'override module metadata');
|
||||||
this._moduleOverrides.push([ngModule, override]);
|
this._moduleOverrides.push([ngModule, override]);
|
||||||
}
|
}
|
||||||
|
|
||||||
overrideComponent(
|
overrideComponent(component: Type<any>, override: MetadataOverride<ComponentMetadataType>): void {
|
||||||
component: ConcreteType<any>, override: MetadataOverride<ComponentMetadataType>): void {
|
|
||||||
this._assertNotInstantiated('overrideComponent', 'override component metadata');
|
this._assertNotInstantiated('overrideComponent', 'override component metadata');
|
||||||
this._componentOverrides.push([component, override]);
|
this._componentOverrides.push([component, override]);
|
||||||
}
|
}
|
||||||
|
|
||||||
overrideDirective(
|
overrideDirective(directive: Type<any>, override: MetadataOverride<DirectiveMetadataType>): void {
|
||||||
directive: ConcreteType<any>, override: MetadataOverride<DirectiveMetadataType>): void {
|
|
||||||
this._assertNotInstantiated('overrideDirective', 'override directive metadata');
|
this._assertNotInstantiated('overrideDirective', 'override directive metadata');
|
||||||
this._directiveOverrides.push([directive, override]);
|
this._directiveOverrides.push([directive, override]);
|
||||||
}
|
}
|
||||||
|
|
||||||
overridePipe(pipe: ConcreteType<any>, override: MetadataOverride<PipeMetadataType>): void {
|
overridePipe(pipe: Type<any>, override: MetadataOverride<PipeMetadataType>): void {
|
||||||
this._assertNotInstantiated('overridePipe', 'override pipe metadata');
|
this._assertNotInstantiated('overridePipe', 'override pipe metadata');
|
||||||
this._pipeOverrides.push([pipe, override]);
|
this._pipeOverrides.push([pipe, override]);
|
||||||
}
|
}
|
||||||
|
|
||||||
createComponent<T>(component: ConcreteType<T>): ComponentFixture<T> {
|
createComponent<T>(component: Type<T>): ComponentFixture<T> {
|
||||||
this._initIfNeeded();
|
this._initIfNeeded();
|
||||||
const componentFactory = this._moduleWithComponentFactories.componentFactories.find(
|
const componentFactory = this._moduleWithComponentFactories.componentFactories.find(
|
||||||
(compFactory) => compFactory.componentType === component);
|
(compFactory) => compFactory.componentType === component);
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Compiler, CompilerOptions, ComponentMetadataType, DirectiveMetadataType, Injector, NgModuleFactory, NgModuleMetadataType, PipeMetadataType} from '../index';
|
import {Compiler, CompilerOptions, ComponentMetadataType, DirectiveMetadataType, Injector, NgModuleMetadataType, PipeMetadataType} from '../index';
|
||||||
import {unimplemented} from '../src/facade/exceptions';
|
import {unimplemented} from '../src/facade/exceptions';
|
||||||
import {ConcreteType} from '../src/facade/lang';
|
import {Type} from '../src/type';
|
||||||
import {MetadataOverride} from './metadata_override';
|
import {MetadataOverride} from './metadata_override';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,19 +18,18 @@ import {MetadataOverride} from './metadata_override';
|
||||||
*/
|
*/
|
||||||
export class TestingCompiler extends Compiler {
|
export class TestingCompiler extends Compiler {
|
||||||
get injector(): Injector { throw unimplemented(); }
|
get injector(): Injector { throw unimplemented(); }
|
||||||
overrideModule(module: ConcreteType<any>, overrides: MetadataOverride<NgModuleMetadataType>):
|
overrideModule(module: Type<any>, overrides: MetadataOverride<NgModuleMetadataType>): void {
|
||||||
|
throw unimplemented();
|
||||||
|
}
|
||||||
|
overrideDirective(directive: Type<any>, overrides: MetadataOverride<DirectiveMetadataType>):
|
||||||
void {
|
void {
|
||||||
throw unimplemented();
|
throw unimplemented();
|
||||||
}
|
}
|
||||||
overrideDirective(
|
overrideComponent(component: Type<any>, overrides: MetadataOverride<ComponentMetadataType>):
|
||||||
directive: ConcreteType<any>, overrides: MetadataOverride<DirectiveMetadataType>): void {
|
void {
|
||||||
throw unimplemented();
|
throw unimplemented();
|
||||||
}
|
}
|
||||||
overrideComponent(
|
overridePipe(directive: Type<any>, overrides: MetadataOverride<PipeMetadataType>): void {
|
||||||
component: ConcreteType<any>, overrides: MetadataOverride<ComponentMetadataType>): void {
|
|
||||||
throw unimplemented();
|
|
||||||
}
|
|
||||||
overridePipe(directive: ConcreteType<any>, overrides: MetadataOverride<PipeMetadataType>): void {
|
|
||||||
throw unimplemented();
|
throw unimplemented();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {AnimationEntryMetadata, Compiler, ComponentFactory, Injectable, Injector, NgZone, OpaqueToken, ViewMetadata} from '../index';
|
import {AnimationEntryMetadata, Compiler, ComponentFactory, Injectable, Injector, NgZone, OpaqueToken, ViewMetadata} from '../index';
|
||||||
import {ConcreteType, Type, isPresent} from '../src/facade/lang';
|
import {isPresent} from '../src/facade/lang';
|
||||||
|
import {Type} from '../src/type';
|
||||||
import {ComponentFixture} from './component_fixture';
|
import {ComponentFixture} from './component_fixture';
|
||||||
import {tick} from './fake_async';
|
import {tick} from './fake_async';
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ export class TestComponentBuilder {
|
||||||
* Overrides only the html of a {@link ComponentMetadata}.
|
* Overrides only the html of a {@link ComponentMetadata}.
|
||||||
* All the other properties of the component's {@link ViewMetadata} are preserved.
|
* All the other properties of the component's {@link ViewMetadata} are preserved.
|
||||||
*/
|
*/
|
||||||
overrideTemplate(componentType: Type, template: string): TestComponentBuilder {
|
overrideTemplate(componentType: Type<any>, template: string): TestComponentBuilder {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'overrideTemplate is not supported in this implementation of TestComponentBuilder.');
|
'overrideTemplate is not supported in this implementation of TestComponentBuilder.');
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ export class TestComponentBuilder {
|
||||||
/**
|
/**
|
||||||
* Overrides a component's {@link ViewMetadata}.
|
* Overrides a component's {@link ViewMetadata}.
|
||||||
*/
|
*/
|
||||||
overrideView(componentType: Type, view: ViewMetadata): TestComponentBuilder {
|
overrideView(componentType: Type<any>, view: ViewMetadata): TestComponentBuilder {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'overrideView is not supported in this implementation of TestComponentBuilder.');
|
'overrideView is not supported in this implementation of TestComponentBuilder.');
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,8 @@ export class TestComponentBuilder {
|
||||||
/**
|
/**
|
||||||
* Overrides the directives from the component {@link ViewMetadata}.
|
* Overrides the directives from the component {@link ViewMetadata}.
|
||||||
*/
|
*/
|
||||||
overrideDirective(componentType: Type, from: Type, to: Type): TestComponentBuilder {
|
overrideDirective(componentType: Type<any>, from: Type<any>, to: Type<any>):
|
||||||
|
TestComponentBuilder {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'overrideDirective is not supported in this implementation of TestComponentBuilder.');
|
'overrideDirective is not supported in this implementation of TestComponentBuilder.');
|
||||||
}
|
}
|
||||||
|
@ -61,7 +62,7 @@ export class TestComponentBuilder {
|
||||||
* duplicated providers to
|
* duplicated providers to
|
||||||
* be overridden.
|
* be overridden.
|
||||||
*/
|
*/
|
||||||
overrideProviders(type: Type, providers: any[]): TestComponentBuilder {
|
overrideProviders(type: Type<any>, providers: any[]): TestComponentBuilder {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'overrideProviders is not supported in this implementation of TestComponentBuilder.');
|
'overrideProviders is not supported in this implementation of TestComponentBuilder.');
|
||||||
}
|
}
|
||||||
|
@ -76,12 +77,12 @@ export class TestComponentBuilder {
|
||||||
* duplicated providers to
|
* duplicated providers to
|
||||||
* be overridden.
|
* be overridden.
|
||||||
*/
|
*/
|
||||||
overrideViewProviders(type: Type, providers: any[]): TestComponentBuilder {
|
overrideViewProviders(type: Type<any>, providers: any[]): TestComponentBuilder {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'overrideViewProviders is not supported in this implementation of TestComponentBuilder.');
|
'overrideViewProviders is not supported in this implementation of TestComponentBuilder.');
|
||||||
}
|
}
|
||||||
|
|
||||||
overrideAnimations(componentType: Type, animations: AnimationEntryMetadata[]):
|
overrideAnimations(componentType: Type<any>, animations: AnimationEntryMetadata[]):
|
||||||
TestComponentBuilder {
|
TestComponentBuilder {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'overrideAnimations is not supported in this implementation of TestComponentBuilder.');
|
'overrideAnimations is not supported in this implementation of TestComponentBuilder.');
|
||||||
|
@ -101,7 +102,7 @@ export class TestComponentBuilder {
|
||||||
/**
|
/**
|
||||||
* Builds and returns a ComponentFixture.
|
* Builds and returns a ComponentFixture.
|
||||||
*/
|
*/
|
||||||
createAsync<T>(rootComponentType: ConcreteType<T>): Promise<ComponentFixture<T>> {
|
createAsync<T>(rootComponentType: Type<T>): Promise<ComponentFixture<T>> {
|
||||||
let noNgZone = this._injector.get(ComponentFixtureNoNgZone, false);
|
let noNgZone = this._injector.get(ComponentFixtureNoNgZone, false);
|
||||||
let ngZone: NgZone = noNgZone ? null : this._injector.get(NgZone, null);
|
let ngZone: NgZone = noNgZone ? null : this._injector.get(NgZone, null);
|
||||||
let compiler: Compiler = this._injector.get(Compiler);
|
let compiler: Compiler = this._injector.get(Compiler);
|
||||||
|
@ -115,7 +116,7 @@ export class TestComponentBuilder {
|
||||||
return ngZone == null ? initComponent() : ngZone.run(initComponent);
|
return ngZone == null ? initComponent() : ngZone.run(initComponent);
|
||||||
}
|
}
|
||||||
|
|
||||||
createFakeAsync<T>(rootComponentType: ConcreteType<T>): ComponentFixture<T> {
|
createFakeAsync<T>(rootComponentType: Type<T>): ComponentFixture<T> {
|
||||||
let result: any /** TODO #9100 */;
|
let result: any /** TODO #9100 */;
|
||||||
let error: any /** TODO #9100 */;
|
let error: any /** TODO #9100 */;
|
||||||
|
|
||||||
|
@ -128,7 +129,7 @@ export class TestComponentBuilder {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
createSync<T>(rootComponentType: ConcreteType<T>): ComponentFixture<T> {
|
createSync<T>(rootComponentType: Type<T>): ComponentFixture<T> {
|
||||||
let noNgZone = this._injector.get(ComponentFixtureNoNgZone, false);
|
let noNgZone = this._injector.get(ComponentFixtureNoNgZone, false);
|
||||||
let ngZone: NgZone = noNgZone ? null : this._injector.get(NgZone, null);
|
let ngZone: NgZone = noNgZone ? null : this._injector.get(NgZone, null);
|
||||||
let compiler: Compiler = this._injector.get(Compiler);
|
let compiler: Compiler = this._injector.get(Compiler);
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
import {Attribute, Component, Directive, Pipe} from '@angular/core';
|
import {Attribute, Component, Directive, Pipe} from '@angular/core';
|
||||||
|
|
||||||
var CustomDirective: Function;
|
class CustomDirective {};
|
||||||
|
|
||||||
// #docregion component
|
// #docregion component
|
||||||
@Component({selector: 'greet', template: 'Hello {{name}}!', directives: [CustomDirective]})
|
@Component({selector: 'greet', template: 'Hello {{name}}!', directives: [CustomDirective]})
|
||||||
|
|
|
@ -57,25 +57,8 @@ var _global: BrowserNodeGlobal = globalScope;
|
||||||
|
|
||||||
export {_global as global};
|
export {_global as global};
|
||||||
|
|
||||||
/**
|
|
||||||
* Runtime representation a type that a Component or other object is instances of.
|
|
||||||
*
|
|
||||||
* An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by
|
|
||||||
* the `MyCustomComponent` constructor function.
|
|
||||||
*
|
|
||||||
* @stable
|
|
||||||
*/
|
|
||||||
export var Type = Function;
|
|
||||||
|
|
||||||
|
export function getTypeNameForDebugging(type: any): string {
|
||||||
export interface Type extends Function {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Runtime representation of a type that is constructable (non-abstract).
|
|
||||||
*/
|
|
||||||
export interface ConcreteType<T> extends Type { new (...args: any[]): T; }
|
|
||||||
|
|
||||||
export function getTypeNameForDebugging(type: Type): string {
|
|
||||||
if (type['name']) {
|
if (type['name']) {
|
||||||
return type['name'];
|
return type['name'];
|
||||||
}
|
}
|
||||||
|
@ -426,7 +409,7 @@ export function isPrimitive(obj: any): boolean {
|
||||||
return !isJsObject(obj);
|
return !isJsObject(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function hasConstructor(value: Object, type: Type): boolean {
|
export function hasConstructor(value: Object, type: any): boolean {
|
||||||
return value.constructor === type;
|
return value.constructor === type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,16 +42,16 @@ export {NgSelectOption, SelectControlValueAccessor} from './directives/select_co
|
||||||
export {NgSelectMultipleOption, SelectMultipleControlValueAccessor} from './directives/select_multiple_control_value_accessor';
|
export {NgSelectMultipleOption, SelectMultipleControlValueAccessor} from './directives/select_multiple_control_value_accessor';
|
||||||
export {MaxLengthValidator, MinLengthValidator, PatternValidator, RequiredValidator} from './directives/validators';
|
export {MaxLengthValidator, MinLengthValidator, PatternValidator, RequiredValidator} from './directives/validators';
|
||||||
|
|
||||||
export const SHARED_FORM_DIRECTIVES: Type[] = [
|
export const SHARED_FORM_DIRECTIVES: Type<any>[] = [
|
||||||
NgSelectOption, NgSelectMultipleOption, DefaultValueAccessor, NumberValueAccessor,
|
NgSelectOption, NgSelectMultipleOption, DefaultValueAccessor, NumberValueAccessor,
|
||||||
CheckboxControlValueAccessor, SelectControlValueAccessor, SelectMultipleControlValueAccessor,
|
CheckboxControlValueAccessor, SelectControlValueAccessor, SelectMultipleControlValueAccessor,
|
||||||
RadioControlValueAccessor, NgControlStatus, RequiredValidator, MinLengthValidator,
|
RadioControlValueAccessor, NgControlStatus, RequiredValidator, MinLengthValidator,
|
||||||
MaxLengthValidator, PatternValidator
|
MaxLengthValidator, PatternValidator
|
||||||
];
|
];
|
||||||
|
|
||||||
export const TEMPLATE_DRIVEN_DIRECTIVES: Type[] = [NgModel, NgModelGroup, NgForm];
|
export const TEMPLATE_DRIVEN_DIRECTIVES: Type<any>[] = [NgModel, NgModelGroup, NgForm];
|
||||||
|
|
||||||
export const REACTIVE_DRIVEN_DIRECTIVES: Type[] =
|
export const REACTIVE_DRIVEN_DIRECTIVES: Type<any>[] =
|
||||||
[FormControlDirective, FormGroupDirective, FormControlName, FormGroupName, FormArrayName];
|
[FormControlDirective, FormGroupDirective, FormControlName, FormGroupName, FormArrayName];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -71,13 +71,13 @@ export const REACTIVE_DRIVEN_DIRECTIVES: Type[] =
|
||||||
* ```
|
* ```
|
||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
export const FORM_DIRECTIVES: Type[][] = [TEMPLATE_DRIVEN_DIRECTIVES, SHARED_FORM_DIRECTIVES];
|
export const FORM_DIRECTIVES: Type<any>[][] = [TEMPLATE_DRIVEN_DIRECTIVES, SHARED_FORM_DIRECTIVES];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export const REACTIVE_FORM_DIRECTIVES: Type[][] =
|
export const REACTIVE_FORM_DIRECTIVES: Type<any>[][] =
|
||||||
[REACTIVE_DRIVEN_DIRECTIVES, SHARED_FORM_DIRECTIVES];
|
[REACTIVE_DRIVEN_DIRECTIVES, SHARED_FORM_DIRECTIVES];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -18,13 +18,13 @@ import {FormBuilder} from './form_builder';
|
||||||
* Shorthand set of providers used for building Angular forms.
|
* Shorthand set of providers used for building Angular forms.
|
||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
export const FORM_PROVIDERS: Type[] = [RadioControlRegistry];
|
export const FORM_PROVIDERS: Type<any>[] = [RadioControlRegistry];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shorthand set of providers used for building reactive Angular forms.
|
* Shorthand set of providers used for building reactive Angular forms.
|
||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
export const REACTIVE_FORM_PROVIDERS: Type[] = [FormBuilder, RadioControlRegistry];
|
export const REACTIVE_FORM_PROVIDERS: Type<any>[] = [FormBuilder, RadioControlRegistry];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ng module for forms.
|
* The ng module for forms.
|
||||||
|
|
|
@ -7,11 +7,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {XHR, analyzeAppProvidersForDeprecatedConfiguration, platformCoreDynamic} from '@angular/compiler';
|
import {XHR, analyzeAppProvidersForDeprecatedConfiguration, platformCoreDynamic} from '@angular/compiler';
|
||||||
import {ApplicationRef, COMPILER_OPTIONS, CUSTOM_ELEMENTS_SCHEMA, Compiler, CompilerFactory, CompilerOptions, ComponentRef, ComponentResolver, ExceptionHandler, NgModule, NgModuleRef, OpaqueToken, PLATFORM_DIRECTIVES, PLATFORM_INITIALIZER, PLATFORM_PIPES, PlatformRef, ReflectiveInjector, SchemaMetadata, Type, assertPlatform, createPlatform, createPlatformFactory, getPlatform, isDevMode} from '@angular/core';
|
import {ApplicationRef, COMPILER_OPTIONS, CUSTOM_ELEMENTS_SCHEMA, CompilerFactory, CompilerOptions, ComponentRef, NgModule, PlatformRef, Type, createPlatformFactory} from '@angular/core';
|
||||||
import {BROWSER_PLATFORM_PROVIDERS, BrowserModule, WORKER_APP_PLATFORM_PROVIDERS, WORKER_SCRIPT, WorkerAppModule, platformBrowser, platformWorkerApp, platformWorkerUi} from '@angular/platform-browser';
|
import {BrowserModule, WORKER_SCRIPT, WorkerAppModule, platformWorkerUi} from '@angular/platform-browser';
|
||||||
|
|
||||||
import {Console} from './core_private';
|
import {Console} from './core_private';
|
||||||
import {ConcreteType, isPresent, stringify} from './src/facade/lang';
|
|
||||||
import {INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS} from './src/platform_providers';
|
import {INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS} from './src/platform_providers';
|
||||||
import {CachedXHR} from './src/xhr/xhr_cache';
|
import {CachedXHR} from './src/xhr/xhr_cache';
|
||||||
import {XHRImpl} from './src/xhr/xhr_impl';
|
import {XHRImpl} from './src/xhr/xhr_impl';
|
||||||
|
@ -121,7 +120,7 @@ export const browserDynamicPlatform = platformBrowserDynamic;
|
||||||
*/
|
*/
|
||||||
// Note: We are using typescript overloads here to have 2 function signatures!
|
// Note: We are using typescript overloads here to have 2 function signatures!
|
||||||
export function bootstrap<C>(
|
export function bootstrap<C>(
|
||||||
appComponentType: ConcreteType<C>,
|
appComponentType: Type<C>,
|
||||||
customProviders?: Array<any /*Type | Provider | any[]*/>): Promise<ComponentRef<C>> {
|
customProviders?: Array<any /*Type | Provider | any[]*/>): Promise<ComponentRef<C>> {
|
||||||
let compilerOptions: CompilerOptions;
|
let compilerOptions: CompilerOptions;
|
||||||
let declarations: any[] = [];
|
let declarations: any[] = [];
|
||||||
|
@ -189,7 +188,7 @@ export const workerAppDynamicPlatform = platformWorkerAppDynamic;
|
||||||
* with the {@link workerAppDynamicPlatform}() instead.
|
* with the {@link workerAppDynamicPlatform}() instead.
|
||||||
*/
|
*/
|
||||||
export function bootstrapWorkerApp<T>(
|
export function bootstrapWorkerApp<T>(
|
||||||
appComponentType: ConcreteType<T>,
|
appComponentType: Type<T>,
|
||||||
customProviders?: Array<any /*Type | Provider | any[]*/>): Promise<ComponentRef<T>> {
|
customProviders?: Array<any /*Type | Provider | any[]*/>): Promise<ComponentRef<T>> {
|
||||||
console.warn(
|
console.warn(
|
||||||
'bootstrapWorkerApp is deprecated. Create an @NgModule that includes the `WorkerAppModule` and use `bootstrapModule` with the `workerAppDynamicPlatform()` instead.');
|
'bootstrapWorkerApp is deprecated. Create an @NgModule that includes the `WorkerAppModule` and use `bootstrapModule` with the `workerAppDynamicPlatform()` instead.');
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
import {DomAdapter} from '../dom/dom_adapter';
|
import {DomAdapter} from '../dom/dom_adapter';
|
||||||
import {StringMapWrapper} from '../facade/collection';
|
import {StringMapWrapper} from '../facade/collection';
|
||||||
import {Type, isFunction, isPresent} from '../facade/lang';
|
import {isFunction, isPresent} from '../facade/lang';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {DebugElement} from '@angular/core';
|
import {DebugElement, Type} from '@angular/core';
|
||||||
|
|
||||||
import {getDOM} from '../../dom/dom_adapter';
|
import {getDOM} from '../../dom/dom_adapter';
|
||||||
import {Predicate} from '../../facade/collection';
|
import {Predicate} from '../../facade/collection';
|
||||||
import {Type, isPresent} from '../../facade/lang';
|
import {isPresent} from '../../facade/lang';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ export class By {
|
||||||
*
|
*
|
||||||
* {@example platform-browser/dom/debug/ts/by/by.ts region='by_directive'}
|
* {@example platform-browser/dom/debug/ts/by/by.ts region='by_directive'}
|
||||||
*/
|
*/
|
||||||
static directive(type: Type): Predicate<DebugElement> {
|
static directive(type: Type<any>): Predicate<DebugElement> {
|
||||||
return (debugElement) => { return debugElement.providerTokens.indexOf(type) !== -1; };
|
return (debugElement) => { return debugElement.providerTokens.indexOf(type) !== -1; };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,9 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Type, isBlank} from '../facade/lang';
|
import {Type} from '@angular/core';
|
||||||
|
|
||||||
|
import {isBlank} from '../facade/lang';
|
||||||
|
|
||||||
var _DOM: DomAdapter = null;
|
var _DOM: DomAdapter = null;
|
||||||
|
|
||||||
|
@ -29,7 +31,7 @@ export function setRootDomAdapter(adapter: DomAdapter) {
|
||||||
* Provides DOM operations in an environment-agnostic way.
|
* Provides DOM operations in an environment-agnostic way.
|
||||||
*/
|
*/
|
||||||
export abstract class DomAdapter {
|
export abstract class DomAdapter {
|
||||||
public xhrType: Type = null;
|
public xhrType: Type<any> = null;
|
||||||
abstract hasProperty(element: any /** TODO #9100 */, name: string): boolean;
|
abstract hasProperty(element: any /** TODO #9100 */, name: string): boolean;
|
||||||
abstract setProperty(el: Element, name: string, value: any): any /** TODO #9100 */;
|
abstract setProperty(el: Element, name: string, value: any): any /** TODO #9100 */;
|
||||||
abstract getProperty(el: Element, name: string): any;
|
abstract getProperty(el: Element, name: string): any;
|
||||||
|
@ -41,7 +43,7 @@ export abstract class DomAdapter {
|
||||||
abstract logGroupEnd(): any /** TODO #9100 */;
|
abstract logGroupEnd(): any /** TODO #9100 */;
|
||||||
|
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
getXHR(): Type { return this.xhrType; }
|
getXHR(): Type<any> { return this.xhrType; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maps attribute names to their corresponding property names for cases
|
* Maps attribute names to their corresponding property names for cases
|
||||||
|
|
|
@ -47,7 +47,7 @@ export class ClientMessageBrokerFactory_ extends ClientMessageBrokerFactory {
|
||||||
* @experimental WebWorker support in Angular is experimental.
|
* @experimental WebWorker support in Angular is experimental.
|
||||||
*/
|
*/
|
||||||
export abstract class ClientMessageBroker {
|
export abstract class ClientMessageBroker {
|
||||||
abstract runOnService(args: UiArguments, returnType: Type): Promise<any>;
|
abstract runOnService(args: UiArguments, returnType: Type<any>): Promise<any>;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface PromiseCompleter {
|
interface PromiseCompleter {
|
||||||
|
@ -82,7 +82,7 @@ export class ClientMessageBroker_ extends ClientMessageBroker {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
runOnService(args: UiArguments, returnType: Type): Promise<any> {
|
runOnService(args: UiArguments, returnType: Type<any>): Promise<any> {
|
||||||
var fnArgs: any[] /** TODO #9100 */ = [];
|
var fnArgs: any[] /** TODO #9100 */ = [];
|
||||||
if (isPresent(args.args)) {
|
if (isPresent(args.args)) {
|
||||||
args.args.forEach(argument => {
|
args.args.forEach(argument => {
|
||||||
|
@ -172,7 +172,7 @@ class MessageData {
|
||||||
* @experimental WebWorker support in Angular is experimental.
|
* @experimental WebWorker support in Angular is experimental.
|
||||||
*/
|
*/
|
||||||
export class FnArg {
|
export class FnArg {
|
||||||
constructor(public value: any /** TODO #9100 */, public type: Type) {}
|
constructor(public value: any /** TODO #9100 */, public type: Type<any>) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -6,12 +6,12 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {BaseException, Injectable, RenderComponentType, ViewEncapsulation} from '@angular/core';
|
import {Injectable, RenderComponentType, Type, ViewEncapsulation} from '@angular/core';
|
||||||
|
|
||||||
import {VIEW_ENCAPSULATION_VALUES} from '../../../core_private';
|
import {VIEW_ENCAPSULATION_VALUES} from '../../../core_private';
|
||||||
import {Map, MapWrapper, StringMapWrapper} from '../../facade/collection';
|
import {Map, MapWrapper, StringMapWrapper} from '../../facade/collection';
|
||||||
import {Type, isArray, isPresent, serializeEnum} from '../../facade/lang';
|
import {BaseException} from '../../facade/exceptions';
|
||||||
|
import {isArray, isPresent, serializeEnum} from '../../facade/lang';
|
||||||
import {RenderStore} from './render_store';
|
import {RenderStore} from './render_store';
|
||||||
import {LocationType} from './serialized_types';
|
import {LocationType} from './serialized_types';
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ import {LocationType} from './serialized_types';
|
||||||
/**
|
/**
|
||||||
* @experimental WebWorker support in Angular is currently experimental.
|
* @experimental WebWorker support in Angular is currently experimental.
|
||||||
*/
|
*/
|
||||||
export const PRIMITIVE: Type = String;
|
export const PRIMITIVE: Type<any> = String;
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class Serializer {
|
export class Serializer {
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Injectable} from '@angular/core';
|
import {Injectable, Type} from '@angular/core';
|
||||||
|
|
||||||
import {EventEmitter} from '../../facade/async';
|
import {EventEmitter} from '../../facade/async';
|
||||||
import {ListWrapper, Map} from '../../facade/collection';
|
import {ListWrapper, Map} from '../../facade/collection';
|
||||||
import {FunctionWrapper, Type, isPresent} from '../../facade/lang';
|
import {FunctionWrapper, isPresent} from '../../facade/lang';
|
||||||
import {MessageBus} from '../shared/message_bus';
|
import {MessageBus} from '../shared/message_bus';
|
||||||
import {Serializer} from '../shared/serializer';
|
import {Serializer} from '../shared/serializer';
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ export class ServiceMessageBrokerFactory_ extends ServiceMessageBrokerFactory {
|
||||||
*/
|
*/
|
||||||
export abstract class ServiceMessageBroker {
|
export abstract class ServiceMessageBroker {
|
||||||
abstract registerMethod(
|
abstract registerMethod(
|
||||||
methodName: string, signature: Type[], method: Function, returnType?: Type): void;
|
methodName: string, signature: Type<any>[], method: Function, returnType?: Type<any>): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ServiceMessageBroker_ extends ServiceMessageBroker {
|
export class ServiceMessageBroker_ extends ServiceMessageBroker {
|
||||||
|
@ -67,8 +67,8 @@ export class ServiceMessageBroker_ extends ServiceMessageBroker {
|
||||||
}
|
}
|
||||||
|
|
||||||
registerMethod(
|
registerMethod(
|
||||||
methodName: string, signature: Type[], method: (..._: any[]) => Promise<any>| void,
|
methodName: string, signature: Type<any>[], method: (..._: any[]) => Promise<any>| void,
|
||||||
returnType?: Type): void {
|
returnType?: Type<any>): void {
|
||||||
this._methods.set(methodName, (message: ReceivedMessage) => {
|
this._methods.set(methodName, (message: ReceivedMessage) => {
|
||||||
var serializedArgs = message.args;
|
var serializedArgs = message.args;
|
||||||
let numArgs = signature === null ? 0 : signature.length;
|
let numArgs = signature === null ? 0 : signature.length;
|
||||||
|
@ -92,7 +92,7 @@ export class ServiceMessageBroker_ extends ServiceMessageBroker {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _wrapWebWorkerPromise(id: string, promise: Promise<any>, type: Type): void {
|
private _wrapWebWorkerPromise(id: string, promise: Promise<any>, type: Type<any>): void {
|
||||||
promise.then((result: any) => {
|
promise.then((result: any) => {
|
||||||
this._sink.emit(
|
this._sink.emit(
|
||||||
{'type': 'result', 'value': this._serializer.serialize(result, type), 'id': id});
|
{'type': 'result', 'value': this._serializer.serialize(result, type), 'id': id});
|
||||||
|
|
|
@ -6,8 +6,10 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import {Type} from '@angular/core';
|
||||||
|
|
||||||
import {DomAdapter, setRootDomAdapter} from '../../dom/dom_adapter';
|
import {DomAdapter, setRootDomAdapter} from '../../dom/dom_adapter';
|
||||||
import {Type} from '../../facade/lang';
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,7 +50,7 @@ export class WorkerDomAdapter extends DomAdapter {
|
||||||
getProperty(el: Element, name: string): any { throw 'not implemented'; }
|
getProperty(el: Element, name: string): any { throw 'not implemented'; }
|
||||||
invoke(el: Element, methodName: string, args: any[]): any { throw 'not implemented'; }
|
invoke(el: Element, methodName: string, args: any[]): any { throw 'not implemented'; }
|
||||||
|
|
||||||
getXHR(): Type { throw 'not implemented'; }
|
getXHR(): Type<any> { throw 'not implemented'; }
|
||||||
|
|
||||||
get attrToPropMap(): {[key: string]: string} { throw 'not implemented'; }
|
get attrToPropMap(): {[key: string]: string} { throw 'not implemented'; }
|
||||||
set attrToPropMap(value: {[key: string]: string}) { throw 'not implemented'; }
|
set attrToPropMap(value: {[key: string]: string}) { throw 'not implemented'; }
|
||||||
|
|
|
@ -6,13 +6,13 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {BaseException} from '@angular/core';
|
import {Type} from '@angular/core';
|
||||||
import {NgZone} from '@angular/core/src/zone/ng_zone';
|
import {NgZone} from '@angular/core/src/zone/ng_zone';
|
||||||
import {ClientMessageBroker, ClientMessageBrokerFactory_, UiArguments} from '@angular/platform-browser/src/web_workers/shared/client_message_broker';
|
import {ClientMessageBroker, ClientMessageBrokerFactory_, UiArguments} from '@angular/platform-browser/src/web_workers/shared/client_message_broker';
|
||||||
import {MessageBus, MessageBusSink, MessageBusSource} from '@angular/platform-browser/src/web_workers/shared/message_bus';
|
import {MessageBus, MessageBusSink, MessageBusSource} from '@angular/platform-browser/src/web_workers/shared/message_bus';
|
||||||
|
|
||||||
import {ListWrapper, StringMapWrapper} from '../../../src/facade/collection';
|
import {ListWrapper, StringMapWrapper} from '../../../src/facade/collection';
|
||||||
import {Type, isPresent} from '../../../src/facade/lang';
|
import {BaseException} from '../../../src/facade/exceptions';
|
||||||
|
import {isPresent} from '../../../src/facade/lang';
|
||||||
import {SpyMessageBroker} from '../worker/spies';
|
import {SpyMessageBroker} from '../worker/spies';
|
||||||
|
|
||||||
import {MockEventEmitter} from './mock_event_emitter';
|
import {MockEventEmitter} from './mock_event_emitter';
|
||||||
|
@ -46,7 +46,7 @@ export function createPairedMessageBuses(): PairedMessageBuses {
|
||||||
export function expectBrokerCall(
|
export function expectBrokerCall(
|
||||||
broker: SpyMessageBroker, methodName: string, vals?: Array<any>,
|
broker: SpyMessageBroker, methodName: string, vals?: Array<any>,
|
||||||
handler?: (..._: any[]) => Promise<any>| void): void {
|
handler?: (..._: any[]) => Promise<any>| void): void {
|
||||||
broker.spy('runOnService').andCallFake((args: UiArguments, returnType: Type) => {
|
broker.spy('runOnService').andCallFake((args: UiArguments, returnType: Type<any>) => {
|
||||||
expect(args.method).toEqual(methodName);
|
expect(args.method).toEqual(methodName);
|
||||||
if (isPresent(vals)) {
|
if (isPresent(vals)) {
|
||||||
expect(args.args.length).toEqual(vals.length);
|
expect(args.args.length).toEqual(vals.length);
|
||||||
|
|
|
@ -6,12 +6,13 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import {Type} from '@angular/core';
|
||||||
import {AsyncTestCompleter, beforeEach, beforeEachProviders, describe, expect, inject, it} from '@angular/core/testing/testing_internal';
|
import {AsyncTestCompleter, beforeEach, beforeEachProviders, describe, expect, inject, it} from '@angular/core/testing/testing_internal';
|
||||||
import {UiArguments} from '@angular/platform-browser/src/web_workers/shared/client_message_broker';
|
import {UiArguments} from '@angular/platform-browser/src/web_workers/shared/client_message_broker';
|
||||||
import {MessageBus} from '@angular/platform-browser/src/web_workers/shared/message_bus';
|
import {MessageBus} from '@angular/platform-browser/src/web_workers/shared/message_bus';
|
||||||
import {LocationType} from '@angular/platform-browser/src/web_workers/shared/serialized_types';
|
import {LocationType} from '@angular/platform-browser/src/web_workers/shared/serialized_types';
|
||||||
import {WebWorkerPlatformLocation} from '@angular/platform-browser/src/web_workers/worker/platform_location';
|
import {WebWorkerPlatformLocation} from '@angular/platform-browser/src/web_workers/worker/platform_location';
|
||||||
import {Type} from '../../../src/facade/lang';
|
|
||||||
import {MockMessageBrokerFactory, createPairedMessageBuses, expectBrokerCall} from '../shared/web_worker_test_util';
|
import {MockMessageBrokerFactory, createPairedMessageBuses, expectBrokerCall} from '../shared/web_worker_test_util';
|
||||||
|
|
||||||
import {SpyMessageBroker} from './spies';
|
import {SpyMessageBroker} from './spies';
|
||||||
|
@ -27,7 +28,7 @@ export function main() {
|
||||||
|
|
||||||
|
|
||||||
function createWebWorkerPlatformLocation(loc: LocationType): WebWorkerPlatformLocation {
|
function createWebWorkerPlatformLocation(loc: LocationType): WebWorkerPlatformLocation {
|
||||||
broker.spy('runOnService').andCallFake((args: UiArguments, returnType: Type) => {
|
broker.spy('runOnService').andCallFake((args: UiArguments, returnType: Type<any>) => {
|
||||||
if (args.method === 'getLocation') {
|
if (args.method === 'getLocation') {
|
||||||
return Promise.resolve(loc);
|
return Promise.resolve(loc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,10 @@ var parse5 = require('parse5/index');
|
||||||
|
|
||||||
import {ListWrapper, StringMapWrapper} from '../src/facade/collection';
|
import {ListWrapper, StringMapWrapper} from '../src/facade/collection';
|
||||||
import {DomAdapter, setRootDomAdapter} from '../platform_browser_private';
|
import {DomAdapter, setRootDomAdapter} from '../platform_browser_private';
|
||||||
import {isPresent, isBlank, global, Type, setValueOnPath, DateWrapper} from '../src/facade/lang';
|
import {isPresent, isBlank, global, setValueOnPath, DateWrapper} from '../src/facade/lang';
|
||||||
import {BaseException} from '@angular/core';
|
import {BaseException} from '../src/facade/exceptions';
|
||||||
import {SelectorMatcher, CssSelector} from '../compiler_private';
|
import {SelectorMatcher, CssSelector} from '../compiler_private';
|
||||||
|
import {Type} from '@angular/core';
|
||||||
import {XHR} from '@angular/compiler';
|
import {XHR} from '@angular/compiler';
|
||||||
|
|
||||||
var parser: any /** TODO #9100 */ = null;
|
var parser: any /** TODO #9100 */ = null;
|
||||||
|
@ -68,7 +69,7 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||||
|
|
||||||
logGroupEnd() {}
|
logGroupEnd() {}
|
||||||
|
|
||||||
getXHR(): Type { return XHR; }
|
getXHR(): Type<XHR> { return XHR; }
|
||||||
|
|
||||||
get attrToPropMap() { return _attrToPropMap; }
|
get attrToPropMap() { return _attrToPropMap; }
|
||||||
|
|
||||||
|
|
|
@ -8,12 +8,11 @@
|
||||||
|
|
||||||
import {PlatformLocation} from '@angular/common';
|
import {PlatformLocation} from '@angular/common';
|
||||||
import {analyzeAppProvidersForDeprecatedConfiguration, platformCoreDynamic} from '@angular/compiler';
|
import {analyzeAppProvidersForDeprecatedConfiguration, platformCoreDynamic} from '@angular/compiler';
|
||||||
import {ApplicationRef, CompilerFactory, ComponentRef, NgModule, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, Type, assertPlatform, createPlatform, createPlatformFactory, getPlatform, platformCore} from '@angular/core';
|
import {ApplicationRef, ComponentRef, NgModule, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, PlatformRef, Type, createPlatformFactory, platformCore} from '@angular/core';
|
||||||
import {BrowserModule} from '@angular/platform-browser';
|
import {BrowserModule} from '@angular/platform-browser';
|
||||||
|
|
||||||
import {Console, ReflectionCapabilities, reflector, wtfInit} from '../core_private';
|
import {Console, ReflectionCapabilities, reflector, wtfInit} from '../core_private';
|
||||||
|
|
||||||
import {ConcreteType} from './facade/lang';
|
|
||||||
import {Parse5DomAdapter} from './parse5_adapter';
|
import {Parse5DomAdapter} from './parse5_adapter';
|
||||||
|
|
||||||
function notSupported(feature: string): Error {
|
function notSupported(feature: string): Error {
|
||||||
|
@ -97,7 +96,7 @@ export const serverDynamicPlatform = platformDynamicServer;
|
||||||
* instead.
|
* instead.
|
||||||
*/
|
*/
|
||||||
export function serverBootstrap<T>(
|
export function serverBootstrap<T>(
|
||||||
appComponentType: ConcreteType<T>,
|
appComponentType: Type<T>,
|
||||||
customProviders: Array<any /*Type | Provider | any[]*/>): Promise<ComponentRef<T>> {
|
customProviders: Array<any /*Type | Provider | any[]*/>): Promise<ComponentRef<T>> {
|
||||||
console.warn(
|
console.warn(
|
||||||
'serverBootstrap is deprecated. Create an @NgModule and use `bootstrapModule` with the `serverDynamicPlatform()` instead.');
|
'serverBootstrap is deprecated. Create an @NgModule and use `bootstrapModule` with the `serverDynamicPlatform()` instead.');
|
||||||
|
|
|
@ -486,7 +486,7 @@ export interface Route {
|
||||||
*/
|
*/
|
||||||
terminal?: boolean;
|
terminal?: boolean;
|
||||||
pathMatch?: string;
|
pathMatch?: string;
|
||||||
component?: Type|string;
|
component?: Type<any>|string;
|
||||||
redirectTo?: string;
|
redirectTo?: string;
|
||||||
outlet?: string;
|
outlet?: string;
|
||||||
canActivate?: any[];
|
canActivate?: any[];
|
||||||
|
|
|
@ -36,14 +36,15 @@ class InheritedFromParent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function recognize(rootComponentType: Type, config: Routes, urlTree: UrlTree, url: string):
|
export function recognize(
|
||||||
Observable<RouterStateSnapshot> {
|
rootComponentType: Type<any>, config: Routes, urlTree: UrlTree,
|
||||||
|
url: string): Observable<RouterStateSnapshot> {
|
||||||
return new Recognizer(rootComponentType, config, urlTree, url).recognize();
|
return new Recognizer(rootComponentType, config, urlTree, url).recognize();
|
||||||
}
|
}
|
||||||
|
|
||||||
class Recognizer {
|
class Recognizer {
|
||||||
constructor(
|
constructor(
|
||||||
private rootComponentType: Type, private config: Routes, private urlTree: UrlTree,
|
private rootComponentType: Type<any>, private config: Routes, private urlTree: UrlTree,
|
||||||
private url: string) {}
|
private url: string) {}
|
||||||
|
|
||||||
recognize(): Observable<RouterStateSnapshot> {
|
recognize(): Observable<RouterStateSnapshot> {
|
||||||
|
|
|
@ -145,7 +145,7 @@ export class Router {
|
||||||
* Creates the router service.
|
* Creates the router service.
|
||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
private rootComponentType: Type, private resolver: ComponentResolver,
|
private rootComponentType: Type<any>, private resolver: ComponentResolver,
|
||||||
private urlSerializer: UrlSerializer, private outletMap: RouterOutletMap,
|
private urlSerializer: UrlSerializer, private outletMap: RouterOutletMap,
|
||||||
private location: Location, private injector: Injector, loader: NgModuleFactoryLoader,
|
private location: Location, private injector: Injector, loader: NgModuleFactoryLoader,
|
||||||
config: Routes) {
|
config: Routes) {
|
||||||
|
|
|
@ -56,7 +56,7 @@ export class RouterState extends Tree<ActivatedRoute> {
|
||||||
toString(): string { return this.snapshot.toString(); }
|
toString(): string { return this.snapshot.toString(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createEmptyState(urlTree: UrlTree, rootComponent: Type): RouterState {
|
export function createEmptyState(urlTree: UrlTree, rootComponent: Type<any>): RouterState {
|
||||||
const snapshot = createEmptyStateSnapshot(urlTree, rootComponent);
|
const snapshot = createEmptyStateSnapshot(urlTree, rootComponent);
|
||||||
const emptyUrl = new BehaviorSubject([new UrlSegment('', {})]);
|
const emptyUrl = new BehaviorSubject([new UrlSegment('', {})]);
|
||||||
const emptyParams = new BehaviorSubject({});
|
const emptyParams = new BehaviorSubject({});
|
||||||
|
@ -71,7 +71,7 @@ export function createEmptyState(urlTree: UrlTree, rootComponent: Type): RouterS
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createEmptyStateSnapshot(
|
export function createEmptyStateSnapshot(
|
||||||
urlTree: UrlTree, rootComponent: Type): RouterStateSnapshot {
|
urlTree: UrlTree, rootComponent: Type<any>): RouterStateSnapshot {
|
||||||
const emptyParams = {};
|
const emptyParams = {};
|
||||||
const emptyData = {};
|
const emptyData = {};
|
||||||
const emptyQueryParams = {};
|
const emptyQueryParams = {};
|
||||||
|
@ -113,7 +113,7 @@ export class ActivatedRoute {
|
||||||
constructor(
|
constructor(
|
||||||
public url: Observable<UrlSegment[]>, public params: Observable<Params>,
|
public url: Observable<UrlSegment[]>, public params: Observable<Params>,
|
||||||
public queryParams: Observable<Params>, public fragment: Observable<string>,
|
public queryParams: Observable<Params>, public fragment: Observable<string>,
|
||||||
public data: Observable<Data>, public outlet: string, public component: Type|string,
|
public data: Observable<Data>, public outlet: string, public component: Type<any>|string,
|
||||||
futureSnapshot: ActivatedRouteSnapshot) {
|
futureSnapshot: ActivatedRouteSnapshot) {
|
||||||
this._futureSnapshot = futureSnapshot;
|
this._futureSnapshot = futureSnapshot;
|
||||||
}
|
}
|
||||||
|
@ -200,7 +200,7 @@ export class ActivatedRouteSnapshot {
|
||||||
constructor(
|
constructor(
|
||||||
public url: UrlSegment[], public params: Params, public queryParams: Params,
|
public url: UrlSegment[], public params: Params, public queryParams: Params,
|
||||||
public fragment: string, public data: Data, public outlet: string,
|
public fragment: string, public data: Data, public outlet: string,
|
||||||
public component: Type|string, routeConfig: Route, urlSegment: UrlSegmentGroup,
|
public component: Type<any>|string, routeConfig: Route, urlSegment: UrlSegmentGroup,
|
||||||
lastPathIndex: number, resolve: InheritedResolve) {
|
lastPathIndex: number, resolve: InheritedResolve) {
|
||||||
this._routeConfig = routeConfig;
|
this._routeConfig = routeConfig;
|
||||||
this._urlSegment = urlSegment;
|
this._urlSegment = urlSegment;
|
||||||
|
|
|
@ -25,13 +25,13 @@ export interface AttrProp {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ComponentInfo {
|
export interface ComponentInfo {
|
||||||
type: Type;
|
type: Type<any>;
|
||||||
selector: string;
|
selector: string;
|
||||||
inputs: AttrProp[];
|
inputs: AttrProp[];
|
||||||
outputs: AttrProp[];
|
outputs: AttrProp[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getComponentInfo(type: Type): ComponentInfo {
|
export function getComponentInfo(type: Type<any>): ComponentInfo {
|
||||||
var resolvedMetadata: DirectiveMetadata = directiveResolver.resolve(type);
|
var resolvedMetadata: DirectiveMetadata = directiveResolver.resolve(type);
|
||||||
var selector = resolvedMetadata.selector;
|
var selector = resolvedMetadata.selector;
|
||||||
if (!selector.match(COMPONENT_SELECTOR)) {
|
if (!selector.match(COMPONENT_SELECTOR)) {
|
||||||
|
|
|
@ -102,7 +102,7 @@ export class UpgradeAdapter {
|
||||||
/* @internal */
|
/* @internal */
|
||||||
private idPrefix: string = `NG2_UPGRADE_${upgradeCount++}_`;
|
private idPrefix: string = `NG2_UPGRADE_${upgradeCount++}_`;
|
||||||
/* @internal */
|
/* @internal */
|
||||||
private upgradedComponents: Type[] = [];
|
private upgradedComponents: Type<any>[] = [];
|
||||||
/**
|
/**
|
||||||
* An internal map of ng1 components which need to up upgraded to ng2.
|
* An internal map of ng1 components which need to up upgraded to ng2.
|
||||||
*
|
*
|
||||||
|
@ -113,11 +113,11 @@ export class UpgradeAdapter {
|
||||||
*/
|
*/
|
||||||
private ng1ComponentsToBeUpgraded: {[name: string]: UpgradeNg1ComponentAdapterBuilder} = {};
|
private ng1ComponentsToBeUpgraded: {[name: string]: UpgradeNg1ComponentAdapterBuilder} = {};
|
||||||
/* @internal */
|
/* @internal */
|
||||||
private providers: Array<Type|Provider|any[]|any> = [];
|
private providers: Array<Type<any>|Provider|any[]|any> = [];
|
||||||
|
|
||||||
// the ng2AppModule param should be required once the deprecated @Component.directives prop is
|
// the ng2AppModule param should be required once the deprecated @Component.directives prop is
|
||||||
// removed
|
// removed
|
||||||
constructor(private ng2AppModule?: Type) {
|
constructor(private ng2AppModule?: Type<any>) {
|
||||||
if (arguments.length && !ng2AppModule) {
|
if (arguments.length && !ng2AppModule) {
|
||||||
throw new BaseException(
|
throw new BaseException(
|
||||||
'UpgradeAdapter constructor called with undefined instead of a ng module type');
|
'UpgradeAdapter constructor called with undefined instead of a ng module type');
|
||||||
|
@ -179,7 +179,7 @@ export class UpgradeAdapter {
|
||||||
* });
|
* });
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
downgradeNg2Component(type: Type): Function {
|
downgradeNg2Component(type: Type<any>): Function {
|
||||||
this.upgradedComponents.push(type);
|
this.upgradedComponents.push(type);
|
||||||
var info: ComponentInfo = getComponentInfo(type);
|
var info: ComponentInfo = getComponentInfo(type);
|
||||||
return ng1ComponentDirective(info, `${this.idPrefix}${info.selector}_c`);
|
return ng1ComponentDirective(info, `${this.idPrefix}${info.selector}_c`);
|
||||||
|
@ -262,7 +262,7 @@ export class UpgradeAdapter {
|
||||||
* });
|
* });
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
upgradeNg1Component(name: string): Type {
|
upgradeNg1Component(name: string): Type<any> {
|
||||||
if ((<any>this.ng1ComponentsToBeUpgraded).hasOwnProperty(name)) {
|
if ((<any>this.ng1ComponentsToBeUpgraded).hasOwnProperty(name)) {
|
||||||
return this.ng1ComponentsToBeUpgraded[name].type;
|
return this.ng1ComponentsToBeUpgraded[name].type;
|
||||||
} else {
|
} else {
|
||||||
|
@ -489,7 +489,9 @@ export class UpgradeAdapter {
|
||||||
* @deprecated Use NgModules and `new UpgradeAdapter(ng2AppModule)` to configure top-level
|
* @deprecated Use NgModules and `new UpgradeAdapter(ng2AppModule)` to configure top-level
|
||||||
*providers
|
*providers
|
||||||
*/
|
*/
|
||||||
public addProvider(provider: Type|Provider|any[]|any): void { this.providers.push(provider); }
|
public addProvider(provider: Type<any>|Provider|any[]|any): void {
|
||||||
|
this.providers.push(provider);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows AngularJS v1 service to be accessible from Angular v2.
|
* Allows AngularJS v1 service to be accessible from Angular v2.
|
||||||
|
|
|
@ -20,7 +20,7 @@ const NOT_SUPPORTED: any = 'NOT_SUPPORTED';
|
||||||
|
|
||||||
|
|
||||||
export class UpgradeNg1ComponentAdapterBuilder {
|
export class UpgradeNg1ComponentAdapterBuilder {
|
||||||
type: Type;
|
type: Type<any>;
|
||||||
inputs: string[] = [];
|
inputs: string[] = [];
|
||||||
inputsRename: string[] = [];
|
inputsRename: string[] = [];
|
||||||
outputs: string[] = [];
|
outputs: string[] = [];
|
||||||
|
|
|
@ -75,7 +75,7 @@ export declare class CheckboxControlValueAccessor implements ControlValueAccesso
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare const COMMON_DIRECTIVES: Type[][];
|
export declare const COMMON_DIRECTIVES: any[];
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare const COMMON_PIPES: (typeof AsyncPipe | typeof SlicePipe | typeof ReplacePipe | typeof I18nPluralPipe | typeof I18nSelectPipe)[];
|
export declare const COMMON_PIPES: (typeof AsyncPipe | typeof SlicePipe | typeof ReplacePipe | typeof I18nPluralPipe | typeof I18nSelectPipe)[];
|
||||||
|
@ -139,7 +139,7 @@ export interface ControlValueAccessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export declare const CORE_DIRECTIVES: Type[];
|
export declare const CORE_DIRECTIVES: Type<any>[];
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare class CurrencyPipe implements PipeTransform {
|
export declare class CurrencyPipe implements PipeTransform {
|
||||||
|
@ -182,10 +182,10 @@ export interface Form {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare const FORM_DIRECTIVES: Type[];
|
export declare const FORM_DIRECTIVES: Type<any>[];
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare const FORM_PROVIDERS: Type[];
|
export declare const FORM_PROVIDERS: Type<any>[];
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare class FormBuilder {
|
export declare class FormBuilder {
|
||||||
|
|
|
@ -128,7 +128,7 @@ export declare const APP_ID: any;
|
||||||
export declare const APP_INITIALIZER: any;
|
export declare const APP_INITIALIZER: any;
|
||||||
|
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
export declare const APPLICATION_COMMON_PROVIDERS: Array<Type | {
|
export declare const APPLICATION_COMMON_PROVIDERS: Array<Type<any> | {
|
||||||
[k: string]: any;
|
[k: string]: any;
|
||||||
} | any[]>;
|
} | any[]>;
|
||||||
|
|
||||||
|
@ -145,11 +145,11 @@ export declare class ApplicationModule {
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare abstract class ApplicationRef {
|
export declare abstract class ApplicationRef {
|
||||||
componentTypes: Type[];
|
componentTypes: Type<any>[];
|
||||||
components: ComponentRef<any>[];
|
components: ComponentRef<any>[];
|
||||||
/** @deprecated */ injector: Injector;
|
/** @deprecated */ injector: Injector;
|
||||||
/** @deprecated */ zone: NgZone;
|
/** @deprecated */ zone: NgZone;
|
||||||
abstract bootstrap<C>(componentFactory: ComponentFactory<C> | ConcreteType<C>): ComponentRef<C>;
|
abstract bootstrap<C>(componentFactory: ComponentFactory<C> | Type<C>): ComponentRef<C>;
|
||||||
/** @deprecated */ abstract dispose(): void;
|
/** @deprecated */ abstract dispose(): void;
|
||||||
/** @deprecated */ abstract registerBootstrapListener(listener: (ref: ComponentRef<any>) => void): void;
|
/** @deprecated */ abstract registerBootstrapListener(listener: (ref: ComponentRef<any>) => void): void;
|
||||||
/** @deprecated */ abstract registerDisposeListener(dispose: () => void): void;
|
/** @deprecated */ abstract registerDisposeListener(dispose: () => void): void;
|
||||||
|
@ -198,11 +198,11 @@ export declare function bind(token: any): ProviderBuilder;
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
export declare class Binding extends Provider {
|
export declare class Binding extends Provider {
|
||||||
/** @deprecated */ toAlias: any;
|
/** @deprecated */ toAlias: any;
|
||||||
/** @deprecated */ toClass: Type;
|
/** @deprecated */ toClass: Type<any>;
|
||||||
/** @deprecated */ toFactory: Function;
|
/** @deprecated */ toFactory: Function;
|
||||||
/** @deprecated */ toValue: any;
|
/** @deprecated */ toValue: any;
|
||||||
constructor(token: any, {toClass, toValue, toAlias, toFactory, deps, multi}: {
|
constructor(token: any, {toClass, toValue, toAlias, toFactory, deps, multi}: {
|
||||||
toClass?: Type;
|
toClass?: Type<any>;
|
||||||
toValue?: any;
|
toValue?: any;
|
||||||
toAlias?: any;
|
toAlias?: any;
|
||||||
toFactory: Function;
|
toFactory: Function;
|
||||||
|
@ -227,13 +227,13 @@ export declare abstract class ChangeDetectorRef {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export declare function Class(clsDef: ClassDefinition): ConcreteType<any>;
|
export declare function Class(clsDef: ClassDefinition): Type<any>;
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export interface ClassDefinition {
|
export interface ClassDefinition {
|
||||||
constructor: Function | any[];
|
constructor: Function | any[];
|
||||||
extends?: Type;
|
extends?: Type<any>;
|
||||||
[x: string]: Type | Function | any[];
|
[x: string]: Type<any> | Function | any[];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
|
@ -249,13 +249,13 @@ export declare class CollectionChangeRecord {
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export declare class Compiler {
|
export declare class Compiler {
|
||||||
clearCache(): void;
|
clearCache(): void;
|
||||||
clearCacheFor(type: Type): void;
|
clearCacheFor(type: Type<any>): void;
|
||||||
compileComponentAsync<T>(component: ConcreteType<T>, ngModule?: Type): Promise<ComponentFactory<T>>;
|
compileComponentAsync<T>(component: Type<T>, ngModule?: Type<any>): Promise<ComponentFactory<T>>;
|
||||||
compileComponentSync<T>(component: ConcreteType<T>, ngModule?: Type): ComponentFactory<T>;
|
compileComponentSync<T>(component: Type<T>, ngModule?: Type<any>): ComponentFactory<T>;
|
||||||
compileModuleAndAllComponentsAsync<T>(moduleType: ConcreteType<T>): Promise<ModuleWithComponentFactories<T>>;
|
compileModuleAndAllComponentsAsync<T>(moduleType: Type<T>): Promise<ModuleWithComponentFactories<T>>;
|
||||||
compileModuleAndAllComponentsSync<T>(moduleType: ConcreteType<T>): ModuleWithComponentFactories<T>;
|
compileModuleAndAllComponentsSync<T>(moduleType: Type<T>): ModuleWithComponentFactories<T>;
|
||||||
compileModuleAsync<T>(moduleType: ConcreteType<T>): Promise<NgModuleFactory<T>>;
|
compileModuleAsync<T>(moduleType: Type<T>): Promise<NgModuleFactory<T>>;
|
||||||
compileModuleSync<T>(moduleType: ConcreteType<T>): NgModuleFactory<T>;
|
compileModuleSync<T>(moduleType: Type<T>): NgModuleFactory<T>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
|
@ -283,15 +283,15 @@ export interface ComponentDecorator extends TypeDecorator {
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export declare class ComponentFactory<C> {
|
export declare class ComponentFactory<C> {
|
||||||
componentType: Type;
|
componentType: Type<any>;
|
||||||
selector: string;
|
selector: string;
|
||||||
constructor(selector: string, _viewFactory: Function, _componentType: Type);
|
constructor(selector: string, _viewFactory: Function, _componentType: Type<any>);
|
||||||
create(injector: Injector, projectableNodes?: any[][], rootSelectorOrNode?: string | any): ComponentRef<C>;
|
create(injector: Injector, projectableNodes?: any[][], rootSelectorOrNode?: string | any): ComponentRef<C>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export declare abstract class ComponentFactoryResolver {
|
export declare abstract class ComponentFactoryResolver {
|
||||||
abstract resolveComponentFactory<T>(component: ConcreteType<T>): ComponentFactory<T>;
|
abstract resolveComponentFactory<T>(component: Type<T>): ComponentFactory<T>;
|
||||||
static NULL: ComponentFactoryResolver;
|
static NULL: ComponentFactoryResolver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,12 +299,12 @@ export declare abstract class ComponentFactoryResolver {
|
||||||
export declare class ComponentMetadata extends DirectiveMetadata implements ComponentMetadataType {
|
export declare class ComponentMetadata extends DirectiveMetadata implements ComponentMetadataType {
|
||||||
animations: AnimationEntryMetadata[];
|
animations: AnimationEntryMetadata[];
|
||||||
changeDetection: ChangeDetectionStrategy;
|
changeDetection: ChangeDetectionStrategy;
|
||||||
directives: Array<Type | any[]>;
|
directives: Array<Type<any> | any[]>;
|
||||||
encapsulation: ViewEncapsulation;
|
encapsulation: ViewEncapsulation;
|
||||||
entryComponents: Array<Type | any[]>;
|
entryComponents: Array<Type<any> | any[]>;
|
||||||
interpolation: [string, string];
|
interpolation: [string, string];
|
||||||
moduleId: string;
|
moduleId: string;
|
||||||
pipes: Array<Type | any[]>;
|
pipes: Array<Type<any> | any[]>;
|
||||||
styleUrls: string[];
|
styleUrls: string[];
|
||||||
styles: string[];
|
styles: string[];
|
||||||
template: string;
|
template: string;
|
||||||
|
@ -323,12 +323,12 @@ export interface ComponentMetadataFactory {
|
||||||
export interface ComponentMetadataType extends DirectiveMetadataType {
|
export interface ComponentMetadataType extends DirectiveMetadataType {
|
||||||
animations?: AnimationEntryMetadata[];
|
animations?: AnimationEntryMetadata[];
|
||||||
changeDetection?: ChangeDetectionStrategy;
|
changeDetection?: ChangeDetectionStrategy;
|
||||||
directives?: Array<Type | any[]>;
|
directives?: Array<Type<any> | any[]>;
|
||||||
encapsulation?: ViewEncapsulation;
|
encapsulation?: ViewEncapsulation;
|
||||||
entryComponents?: Array<Type | any[]>;
|
entryComponents?: Array<Type<any> | any[]>;
|
||||||
interpolation?: [string, string];
|
interpolation?: [string, string];
|
||||||
moduleId?: string;
|
moduleId?: string;
|
||||||
pipes?: Array<Type | any[]>;
|
pipes?: Array<Type<any> | any[]>;
|
||||||
styleUrls?: string[];
|
styleUrls?: string[];
|
||||||
styles?: string[];
|
styles?: string[];
|
||||||
template?: string;
|
template?: string;
|
||||||
|
@ -339,7 +339,7 @@ export interface ComponentMetadataType extends DirectiveMetadataType {
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export declare abstract class ComponentRef<C> {
|
export declare abstract class ComponentRef<C> {
|
||||||
changeDetectorRef: ChangeDetectorRef;
|
changeDetectorRef: ChangeDetectorRef;
|
||||||
componentType: Type;
|
componentType: Type<any>;
|
||||||
hostView: ViewRef;
|
hostView: ViewRef;
|
||||||
injector: Injector;
|
injector: Injector;
|
||||||
instance: C;
|
instance: C;
|
||||||
|
@ -351,15 +351,15 @@ export declare abstract class ComponentRef<C> {
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
export declare abstract class ComponentResolver {
|
export declare abstract class ComponentResolver {
|
||||||
abstract clearCache(): void;
|
abstract clearCache(): void;
|
||||||
abstract resolveComponent(component: Type | string): Promise<ComponentFactory<any>>;
|
abstract resolveComponent(component: Type<any> | string): Promise<ComponentFactory<any>>;
|
||||||
static DynamicCompilationDeprecationMsg: string;
|
static DynamicCompilationDeprecationMsg: string;
|
||||||
static LazyLoadingDeprecationMsg: string;
|
static LazyLoadingDeprecationMsg: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export declare class ComponentStillLoadingError extends BaseException {
|
export declare class ComponentStillLoadingError extends BaseException {
|
||||||
compType: Type;
|
compType: Type<any>;
|
||||||
constructor(compType: Type);
|
constructor(compType: Type<any>);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
|
@ -367,17 +367,17 @@ export declare var ContentChild: ContentChildMetadataFactory;
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export declare class ContentChildMetadata extends QueryMetadata {
|
export declare class ContentChildMetadata extends QueryMetadata {
|
||||||
constructor(_selector: Type | string, {read}?: {
|
constructor(_selector: Type<any> | string, {read}?: {
|
||||||
read?: any;
|
read?: any;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export interface ContentChildMetadataFactory {
|
export interface ContentChildMetadataFactory {
|
||||||
(selector: Type | string, {read}?: {
|
(selector: Type<any> | Function | string, {read}?: {
|
||||||
read?: any;
|
read?: any;
|
||||||
}): any;
|
}): any;
|
||||||
new (selector: Type | string, {read}?: {
|
new (selector: Type<any> | Function | string, {read}?: {
|
||||||
read?: any;
|
read?: any;
|
||||||
}): ContentChildMetadataFactory;
|
}): ContentChildMetadataFactory;
|
||||||
}
|
}
|
||||||
|
@ -387,7 +387,7 @@ export declare var ContentChildren: ContentChildrenMetadataFactory;
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export declare class ContentChildrenMetadata extends QueryMetadata {
|
export declare class ContentChildrenMetadata extends QueryMetadata {
|
||||||
constructor(_selector: Type | string, {descendants, read}?: {
|
constructor(_selector: Type<any> | string, {descendants, read}?: {
|
||||||
descendants?: boolean;
|
descendants?: boolean;
|
||||||
read?: any;
|
read?: any;
|
||||||
});
|
});
|
||||||
|
@ -395,11 +395,11 @@ export declare class ContentChildrenMetadata extends QueryMetadata {
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export interface ContentChildrenMetadataFactory {
|
export interface ContentChildrenMetadataFactory {
|
||||||
(selector: Type | string, {descendants, read}?: {
|
(selector: Type<any> | Function | string, {descendants, read}?: {
|
||||||
descendants?: boolean;
|
descendants?: boolean;
|
||||||
read?: any;
|
read?: any;
|
||||||
}): any;
|
}): any;
|
||||||
new (selector: Type | string, {descendants, read}?: {
|
new (selector: Type<any> | Function | string, {descendants, read}?: {
|
||||||
descendants?: boolean;
|
descendants?: boolean;
|
||||||
read?: any;
|
read?: any;
|
||||||
}): ContentChildrenMetadata;
|
}): ContentChildrenMetadata;
|
||||||
|
@ -409,7 +409,7 @@ export interface ContentChildrenMetadataFactory {
|
||||||
export declare function coreBootstrap<C>(componentFactory: ComponentFactory<C>, injector: Injector): ComponentRef<C>;
|
export declare function coreBootstrap<C>(componentFactory: ComponentFactory<C>, injector: Injector): ComponentRef<C>;
|
||||||
|
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
export declare function coreLoadAndBootstrap(componentType: Type, injector: Injector): Promise<ComponentRef<any>>;
|
export declare function coreLoadAndBootstrap(componentType: Type<any>, injector: Injector): Promise<ComponentRef<any>>;
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare function createPlatform(injector: Injector): PlatformRef;
|
export declare function createPlatform(injector: Injector): PlatformRef;
|
||||||
|
@ -547,8 +547,8 @@ export declare abstract class DoCheck {
|
||||||
|
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
export declare abstract class DynamicComponentLoader {
|
export declare abstract class DynamicComponentLoader {
|
||||||
abstract loadAsRoot(type: Type, overrideSelectorOrNode: string | any, injector: Injector, onDispose?: () => void, projectableNodes?: any[][]): Promise<ComponentRef<any>>;
|
abstract loadAsRoot(type: Type<any>, overrideSelectorOrNode: string | any, injector: Injector, onDispose?: () => void, projectableNodes?: any[][]): Promise<ComponentRef<any>>;
|
||||||
abstract loadNextToLocation(type: Type, location: ViewContainerRef, providers?: ResolvedReflectiveProvider[], projectableNodes?: any[][]): Promise<ComponentRef<any>>;
|
abstract loadNextToLocation(type: Type<any>, location: ViewContainerRef, providers?: ResolvedReflectiveProvider[], projectableNodes?: any[][]): Promise<ComponentRef<any>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
|
@ -589,7 +589,7 @@ export declare class ExpressionChangedAfterItHasBeenCheckedException extends Bas
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare function forwardRef(forwardRefFn: ForwardRefFn): Type;
|
export declare function forwardRef(forwardRefFn: ForwardRefFn): Type<any>;
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export interface ForwardRefFn {
|
export interface ForwardRefFn {
|
||||||
|
@ -792,7 +792,7 @@ export declare class ModuleWithComponentFactories<T> {
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export interface ModuleWithProviders {
|
export interface ModuleWithProviders {
|
||||||
ngModule: Type;
|
ngModule: Type<any>;
|
||||||
providers?: any[];
|
providers?: any[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -805,10 +805,10 @@ export interface NgModuleDecorator extends TypeDecorator {
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare class NgModuleFactory<T> {
|
export declare class NgModuleFactory<T> {
|
||||||
moduleType: ConcreteType<T>;
|
moduleType: Type<T>;
|
||||||
constructor(_injectorClass: {
|
constructor(_injectorClass: {
|
||||||
new (parentInjector: Injector): NgModuleInjector<T>;
|
new (parentInjector: Injector): NgModuleInjector<T>;
|
||||||
}, _moduleype: ConcreteType<T>);
|
}, _moduleype: Type<T>);
|
||||||
create(parentInjector: Injector): NgModuleRef<T>;
|
create(parentInjector: Injector): NgModuleRef<T>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -819,11 +819,11 @@ export declare abstract class NgModuleFactoryLoader {
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare class NgModuleMetadata extends InjectableMetadata implements NgModuleMetadataType {
|
export declare class NgModuleMetadata extends InjectableMetadata implements NgModuleMetadataType {
|
||||||
bootstrap: Array<Type | any[]>;
|
bootstrap: Array<Type<any> | any[]>;
|
||||||
declarations: Array<Type | any[]>;
|
declarations: Array<Type<any> | any[]>;
|
||||||
entryComponents: Array<Type | any[]>;
|
entryComponents: Array<Type<any> | any[]>;
|
||||||
exports: Array<Type | any[]>;
|
exports: Array<Type<any> | any[]>;
|
||||||
imports: Array<Type | ModuleWithProviders | any[]>;
|
imports: Array<Type<any> | ModuleWithProviders | any[]>;
|
||||||
providers: any[];
|
providers: any[];
|
||||||
schemas: Array<SchemaMetadata | any[]>;
|
schemas: Array<SchemaMetadata | any[]>;
|
||||||
constructor(options?: NgModuleMetadataType);
|
constructor(options?: NgModuleMetadataType);
|
||||||
|
@ -837,11 +837,11 @@ export interface NgModuleMetadataFactory {
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export interface NgModuleMetadataType {
|
export interface NgModuleMetadataType {
|
||||||
bootstrap?: Array<Type | any[]>;
|
bootstrap?: Array<Type<any> | any[]>;
|
||||||
declarations?: Array<Type | any[]>;
|
declarations?: Array<Type<any> | any[]>;
|
||||||
entryComponents?: Array<Type | any[]>;
|
entryComponents?: Array<Type<any> | any[]>;
|
||||||
exports?: Array<Type | any[]>;
|
exports?: Array<Type<any> | any[]>;
|
||||||
imports?: Array<Type | ModuleWithProviders | any[]>;
|
imports?: Array<Type<any> | ModuleWithProviders | any[]>;
|
||||||
providers?: any[];
|
providers?: any[];
|
||||||
schemas?: Array<SchemaMetadata | any[]>;
|
schemas?: Array<SchemaMetadata | any[]>;
|
||||||
}
|
}
|
||||||
|
@ -884,7 +884,7 @@ export declare class NgZoneError {
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export declare class NoAnnotationError extends BaseException {
|
export declare class NoAnnotationError extends BaseException {
|
||||||
constructor(typeOrFunc: Type | Function, params: any[][]);
|
constructor(typeOrFunc: Type<any> | Function, params: any[][]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
|
@ -1003,7 +1003,7 @@ export declare abstract class PlatformRef {
|
||||||
destroyed: boolean;
|
destroyed: boolean;
|
||||||
/** @deprecated */ disposed: boolean;
|
/** @deprecated */ disposed: boolean;
|
||||||
injector: Injector;
|
injector: Injector;
|
||||||
/** @stable */ bootstrapModule<M>(moduleType: ConcreteType<M>, compilerOptions?: CompilerOptions | CompilerOptions[]): Promise<NgModuleRef<M>>;
|
/** @stable */ bootstrapModule<M>(moduleType: Type<M>, compilerOptions?: CompilerOptions | CompilerOptions[]): Promise<NgModuleRef<M>>;
|
||||||
/** @experimental */ bootstrapModuleFactory<M>(moduleFactory: NgModuleFactory<M>): Promise<NgModuleRef<M>>;
|
/** @experimental */ bootstrapModuleFactory<M>(moduleFactory: NgModuleFactory<M>): Promise<NgModuleRef<M>>;
|
||||||
abstract destroy(): void;
|
abstract destroy(): void;
|
||||||
/** @deprecated */ abstract dispose(): void;
|
/** @deprecated */ abstract dispose(): void;
|
||||||
|
@ -1013,7 +1013,7 @@ export declare abstract class PlatformRef {
|
||||||
|
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
export declare function provide(token: any, {useClass, useValue, useExisting, useFactory, deps, multi}: {
|
export declare function provide(token: any, {useClass, useValue, useExisting, useFactory, deps, multi}: {
|
||||||
useClass?: Type;
|
useClass?: Type<any>;
|
||||||
useValue?: any;
|
useValue?: any;
|
||||||
useExisting?: any;
|
useExisting?: any;
|
||||||
useFactory?: Function;
|
useFactory?: Function;
|
||||||
|
@ -1026,12 +1026,12 @@ export declare class Provider {
|
||||||
dependencies: Object[];
|
dependencies: Object[];
|
||||||
multi: boolean;
|
multi: boolean;
|
||||||
token: any;
|
token: any;
|
||||||
useClass: Type;
|
useClass: Type<any>;
|
||||||
useExisting: any;
|
useExisting: any;
|
||||||
useFactory: Function;
|
useFactory: Function;
|
||||||
useValue: any;
|
useValue: any;
|
||||||
constructor(token: any, {useClass, useValue, useExisting, useFactory, deps, multi}: {
|
constructor(token: any, {useClass, useValue, useExisting, useFactory, deps, multi}: {
|
||||||
useClass?: Type;
|
useClass?: Type<any>;
|
||||||
useValue?: any;
|
useValue?: any;
|
||||||
useExisting?: any;
|
useExisting?: any;
|
||||||
useFactory?: Function;
|
useFactory?: Function;
|
||||||
|
@ -1045,7 +1045,7 @@ export declare class ProviderBuilder {
|
||||||
token: any;
|
token: any;
|
||||||
constructor(token: any);
|
constructor(token: any);
|
||||||
toAlias(aliasToken: any): Provider;
|
toAlias(aliasToken: any): Provider;
|
||||||
toClass(type: Type): Provider;
|
toClass(type: Type<any>): Provider;
|
||||||
toFactory(factory: Function, dependencies?: any[]): Provider;
|
toFactory(factory: Function, dependencies?: any[]): Provider;
|
||||||
toValue(value: any): Provider;
|
toValue(value: any): Provider;
|
||||||
}
|
}
|
||||||
|
@ -1081,7 +1081,7 @@ export declare class QueryMetadata extends DependencyMetadata {
|
||||||
read: any;
|
read: any;
|
||||||
selector: any;
|
selector: any;
|
||||||
varBindings: string[];
|
varBindings: string[];
|
||||||
constructor(_selector: Type | string, {descendants, first, read}?: {
|
constructor(_selector: Type<any> | string, {descendants, first, read}?: {
|
||||||
descendants?: boolean;
|
descendants?: boolean;
|
||||||
first?: boolean;
|
first?: boolean;
|
||||||
read?: any;
|
read?: any;
|
||||||
|
@ -1091,11 +1091,11 @@ export declare class QueryMetadata extends DependencyMetadata {
|
||||||
|
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
export interface QueryMetadataFactory {
|
export interface QueryMetadataFactory {
|
||||||
(selector: Type | string, {descendants, read}?: {
|
(selector: Type<any> | Function | string, {descendants, read}?: {
|
||||||
descendants?: boolean;
|
descendants?: boolean;
|
||||||
read?: any;
|
read?: any;
|
||||||
}): ParameterDecorator;
|
}): ParameterDecorator;
|
||||||
new (selector: Type | string, {descendants, read}?: {
|
new (selector: Type<any> | Function | string, {descendants, read}?: {
|
||||||
descendants?: boolean;
|
descendants?: boolean;
|
||||||
read?: any;
|
read?: any;
|
||||||
}): QueryMetadata;
|
}): QueryMetadata;
|
||||||
|
@ -1107,16 +1107,16 @@ export declare abstract class ReflectiveInjector implements Injector {
|
||||||
createChildFromResolved(providers: ResolvedReflectiveProvider[]): ReflectiveInjector;
|
createChildFromResolved(providers: ResolvedReflectiveProvider[]): ReflectiveInjector;
|
||||||
abstract get(token: any, notFoundValue?: any): any;
|
abstract get(token: any, notFoundValue?: any): any;
|
||||||
instantiateResolved(provider: ResolvedReflectiveProvider): any;
|
instantiateResolved(provider: ResolvedReflectiveProvider): any;
|
||||||
resolveAndCreateChild(providers: Array<Type | Provider | {
|
resolveAndCreateChild(providers: Array<Type<any> | Provider | {
|
||||||
[k: string]: any;
|
[k: string]: any;
|
||||||
} | any[]>): ReflectiveInjector;
|
} | any[]>): ReflectiveInjector;
|
||||||
resolveAndInstantiate(provider: Type | Provider): any;
|
resolveAndInstantiate(provider: Type<any> | Provider): any;
|
||||||
/** @deprecated */ static fromResolvedBindings(providers: ResolvedReflectiveProvider[]): ReflectiveInjector;
|
/** @deprecated */ static fromResolvedBindings(providers: ResolvedReflectiveProvider[]): ReflectiveInjector;
|
||||||
/** @experimental */ static fromResolvedProviders(providers: ResolvedReflectiveProvider[], parent?: Injector): ReflectiveInjector;
|
/** @experimental */ static fromResolvedProviders(providers: ResolvedReflectiveProvider[], parent?: Injector): ReflectiveInjector;
|
||||||
static resolve(providers: Array<Type | Provider | {
|
static resolve(providers: Array<Type<any> | Provider | {
|
||||||
[k: string]: any;
|
[k: string]: any;
|
||||||
} | any[]>): ResolvedReflectiveProvider[];
|
} | any[]>): ResolvedReflectiveProvider[];
|
||||||
static resolveAndCreate(providers: Array<Type | Provider | {
|
static resolveAndCreate(providers: Array<Type<any> | Provider | {
|
||||||
[k: string]: any;
|
[k: string]: any;
|
||||||
} | any[]>, parent?: Injector): ReflectiveInjector;
|
} | any[]>, parent?: Injector): ReflectiveInjector;
|
||||||
}
|
}
|
||||||
|
@ -1278,14 +1278,14 @@ export declare function style(tokens: string | {
|
||||||
export declare class SystemJsCmpFactoryResolver implements ComponentResolver {
|
export declare class SystemJsCmpFactoryResolver implements ComponentResolver {
|
||||||
constructor(_console: Console);
|
constructor(_console: Console);
|
||||||
clearCache(): void;
|
clearCache(): void;
|
||||||
resolveComponent(componentType: string | Type): Promise<ComponentFactory<any>>;
|
resolveComponent(componentType: string | Type<any>): Promise<ComponentFactory<any>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
export declare class SystemJsComponentResolver implements ComponentResolver {
|
export declare class SystemJsComponentResolver implements ComponentResolver {
|
||||||
constructor(_resolver: ComponentResolver, _console: Console);
|
constructor(_resolver: ComponentResolver, _console: Console);
|
||||||
clearCache(): void;
|
clearCache(): void;
|
||||||
resolveComponent(componentType: string | Type): Promise<ComponentFactory<any>>;
|
resolveComponent(componentType: string | Type<any>): Promise<ComponentFactory<any>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
|
@ -1340,8 +1340,8 @@ export declare var Type: FunctionConstructor;
|
||||||
export interface TypeDecorator {
|
export interface TypeDecorator {
|
||||||
annotations: any[];
|
annotations: any[];
|
||||||
(target: Object, propertyKey?: string | symbol, parameterIndex?: number): void;
|
(target: Object, propertyKey?: string | symbol, parameterIndex?: number): void;
|
||||||
<T extends Type>(type: T): T;
|
<T extends Type<any>>(type: T): T;
|
||||||
Class(obj: ClassDefinition): ConcreteType<any>;
|
Class(obj: ClassDefinition): Type<any>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
|
@ -1349,17 +1349,17 @@ export declare var ViewChild: ViewChildMetadataFactory;
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export declare class ViewChildMetadata extends ViewQueryMetadata {
|
export declare class ViewChildMetadata extends ViewQueryMetadata {
|
||||||
constructor(_selector: Type | string, {read}?: {
|
constructor(_selector: Type<any> | string, {read}?: {
|
||||||
read?: any;
|
read?: any;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export interface ViewChildMetadataFactory {
|
export interface ViewChildMetadataFactory {
|
||||||
(selector: Type | string, {read}?: {
|
(selector: Type<any> | Function | string, {read}?: {
|
||||||
read?: any;
|
read?: any;
|
||||||
}): any;
|
}): any;
|
||||||
new (selector: Type | string, {read}?: {
|
new (selector: Type<any> | Function | string, {read}?: {
|
||||||
read?: any;
|
read?: any;
|
||||||
}): ViewChildMetadataFactory;
|
}): ViewChildMetadataFactory;
|
||||||
}
|
}
|
||||||
|
@ -1369,17 +1369,17 @@ export declare var ViewChildren: ViewChildrenMetadataFactory;
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export declare class ViewChildrenMetadata extends ViewQueryMetadata {
|
export declare class ViewChildrenMetadata extends ViewQueryMetadata {
|
||||||
constructor(_selector: Type | string, {read}?: {
|
constructor(_selector: Type<any> | string, {read}?: {
|
||||||
read?: any;
|
read?: any;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export interface ViewChildrenMetadataFactory {
|
export interface ViewChildrenMetadataFactory {
|
||||||
(selector: Type | string, {read}?: {
|
(selector: Type<any> | Function | string, {read}?: {
|
||||||
read?: any;
|
read?: any;
|
||||||
}): any;
|
}): any;
|
||||||
new (selector: Type | string, {read}?: {
|
new (selector: Type<any> | Function | string, {read}?: {
|
||||||
read?: any;
|
read?: any;
|
||||||
}): ViewChildrenMetadata;
|
}): ViewChildrenMetadata;
|
||||||
}
|
}
|
||||||
|
@ -1411,10 +1411,10 @@ export declare enum ViewEncapsulation {
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
export declare class ViewMetadata {
|
export declare class ViewMetadata {
|
||||||
animations: AnimationEntryMetadata[];
|
animations: AnimationEntryMetadata[];
|
||||||
directives: Array<Type | any[]>;
|
directives: Array<Type<any> | any[]>;
|
||||||
encapsulation: ViewEncapsulation;
|
encapsulation: ViewEncapsulation;
|
||||||
interpolation: [string, string];
|
interpolation: [string, string];
|
||||||
pipes: Array<Type | any[]>;
|
pipes: Array<Type<any> | any[]>;
|
||||||
styleUrls: string[];
|
styleUrls: string[];
|
||||||
styles: string[];
|
styles: string[];
|
||||||
template: string;
|
template: string;
|
||||||
|
@ -1422,8 +1422,8 @@ export declare class ViewMetadata {
|
||||||
constructor({templateUrl, template, directives, pipes, encapsulation, styles, styleUrls, animations, interpolation}?: {
|
constructor({templateUrl, template, directives, pipes, encapsulation, styles, styleUrls, animations, interpolation}?: {
|
||||||
templateUrl?: string;
|
templateUrl?: string;
|
||||||
template?: string;
|
template?: string;
|
||||||
directives?: Array<Type | any[]>;
|
directives?: Array<Type<any> | any[]>;
|
||||||
pipes?: Array<Type | any[]>;
|
pipes?: Array<Type<any> | any[]>;
|
||||||
encapsulation?: ViewEncapsulation;
|
encapsulation?: ViewEncapsulation;
|
||||||
styles?: string[];
|
styles?: string[];
|
||||||
styleUrls?: string[];
|
styleUrls?: string[];
|
||||||
|
@ -1438,7 +1438,7 @@ export declare var ViewQuery: QueryMetadataFactory;
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
export declare class ViewQueryMetadata extends QueryMetadata {
|
export declare class ViewQueryMetadata extends QueryMetadata {
|
||||||
isViewQuery: boolean;
|
isViewQuery: boolean;
|
||||||
constructor(_selector: Type | string, {descendants, first, read}?: {
|
constructor(_selector: Type<any> | string, {descendants, first, read}?: {
|
||||||
descendants?: boolean;
|
descendants?: boolean;
|
||||||
first?: boolean;
|
first?: boolean;
|
||||||
read?: any;
|
read?: any;
|
||||||
|
|
|
@ -61,7 +61,7 @@ export declare function resetFakeAsyncZone(): void;
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare class TestBed implements Injector {
|
export declare class TestBed implements Injector {
|
||||||
ngModule: Type;
|
ngModule: Type<any>;
|
||||||
platform: PlatformRef;
|
platform: PlatformRef;
|
||||||
compileComponents(): Promise<any>;
|
compileComponents(): Promise<any>;
|
||||||
configureCompiler(config: {
|
configureCompiler(config: {
|
||||||
|
@ -69,14 +69,14 @@ export declare class TestBed implements Injector {
|
||||||
useJit?: boolean;
|
useJit?: boolean;
|
||||||
}): void;
|
}): void;
|
||||||
configureTestingModule(moduleDef: TestModuleMetadata): void;
|
configureTestingModule(moduleDef: TestModuleMetadata): void;
|
||||||
createComponent<T>(component: ConcreteType<T>): ComponentFixture<T>;
|
createComponent<T>(component: Type<T>): ComponentFixture<T>;
|
||||||
execute(tokens: any[], fn: Function): any;
|
execute(tokens: any[], fn: Function): any;
|
||||||
get(token: any, notFoundValue?: any): any;
|
get(token: any, notFoundValue?: any): any;
|
||||||
/** @experimental */ initTestEnvironment(ngModule: Type, platform: PlatformRef): void;
|
/** @experimental */ initTestEnvironment(ngModule: Type<any>, platform: PlatformRef): void;
|
||||||
overrideComponent(component: ConcreteType<any>, override: MetadataOverride<ComponentMetadataType>): void;
|
overrideComponent(component: Type<any>, override: MetadataOverride<ComponentMetadataType>): void;
|
||||||
overrideDirective(directive: ConcreteType<any>, override: MetadataOverride<DirectiveMetadataType>): void;
|
overrideDirective(directive: Type<any>, override: MetadataOverride<DirectiveMetadataType>): void;
|
||||||
overrideModule(ngModule: ConcreteType<any>, override: MetadataOverride<NgModuleMetadataType>): void;
|
overrideModule(ngModule: Type<any>, override: MetadataOverride<NgModuleMetadataType>): void;
|
||||||
overridePipe(pipe: ConcreteType<any>, override: MetadataOverride<PipeMetadataType>): void;
|
overridePipe(pipe: Type<any>, override: MetadataOverride<PipeMetadataType>): void;
|
||||||
/** @deprecated */ reset(): void;
|
/** @deprecated */ reset(): void;
|
||||||
/** @experimental */ resetTestEnvironment(): void;
|
/** @experimental */ resetTestEnvironment(): void;
|
||||||
resetTestingModule(): void;
|
resetTestingModule(): void;
|
||||||
|
@ -86,12 +86,12 @@ export declare class TestBed implements Injector {
|
||||||
useJit?: boolean;
|
useJit?: boolean;
|
||||||
}): typeof TestBed;
|
}): typeof TestBed;
|
||||||
static configureTestingModule(moduleDef: TestModuleMetadata): typeof TestBed;
|
static configureTestingModule(moduleDef: TestModuleMetadata): typeof TestBed;
|
||||||
static createComponent<T>(component: ConcreteType<T>): ComponentFixture<T>;
|
static createComponent<T>(component: Type<T>): ComponentFixture<T>;
|
||||||
/** @experimental */ static initTestEnvironment(ngModule: Type, platform: PlatformRef): TestBed;
|
/** @experimental */ static initTestEnvironment(ngModule: Type<any>, platform: PlatformRef): TestBed;
|
||||||
static overrideComponent(component: ConcreteType<any>, override: MetadataOverride<ComponentMetadataType>): typeof TestBed;
|
static overrideComponent(component: Type<any>, override: MetadataOverride<ComponentMetadataType>): typeof TestBed;
|
||||||
static overrideDirective(directive: ConcreteType<any>, override: MetadataOverride<DirectiveMetadataType>): typeof TestBed;
|
static overrideDirective(directive: Type<any>, override: MetadataOverride<DirectiveMetadataType>): typeof TestBed;
|
||||||
static overrideModule(ngModule: ConcreteType<any>, override: MetadataOverride<NgModuleMetadataType>): typeof TestBed;
|
static overrideModule(ngModule: Type<any>, override: MetadataOverride<NgModuleMetadataType>): typeof TestBed;
|
||||||
static overridePipe(pipe: ConcreteType<any>, override: MetadataOverride<PipeMetadataType>): typeof TestBed;
|
static overridePipe(pipe: Type<any>, override: MetadataOverride<PipeMetadataType>): typeof TestBed;
|
||||||
/** @experimental */ static resetTestEnvironment(): void;
|
/** @experimental */ static resetTestEnvironment(): void;
|
||||||
static resetTestingModule(): typeof TestBed;
|
static resetTestingModule(): typeof TestBed;
|
||||||
}
|
}
|
||||||
|
@ -100,16 +100,16 @@ export declare class TestBed implements Injector {
|
||||||
export declare class TestComponentBuilder {
|
export declare class TestComponentBuilder {
|
||||||
protected _injector: Injector;
|
protected _injector: Injector;
|
||||||
constructor(_injector: Injector);
|
constructor(_injector: Injector);
|
||||||
createAsync<T>(rootComponentType: ConcreteType<T>): Promise<ComponentFixture<T>>;
|
createAsync<T>(rootComponentType: Type<T>): Promise<ComponentFixture<T>>;
|
||||||
createFakeAsync<T>(rootComponentType: ConcreteType<T>): ComponentFixture<T>;
|
createFakeAsync<T>(rootComponentType: Type<T>): ComponentFixture<T>;
|
||||||
protected createFromFactory<C>(ngZone: NgZone, componentFactory: ComponentFactory<C>): ComponentFixture<C>;
|
protected createFromFactory<C>(ngZone: NgZone, componentFactory: ComponentFactory<C>): ComponentFixture<C>;
|
||||||
createSync<T>(rootComponentType: ConcreteType<T>): ComponentFixture<T>;
|
createSync<T>(rootComponentType: Type<T>): ComponentFixture<T>;
|
||||||
overrideAnimations(componentType: Type, animations: AnimationEntryMetadata[]): TestComponentBuilder;
|
overrideAnimations(componentType: Type<any>, animations: AnimationEntryMetadata[]): TestComponentBuilder;
|
||||||
overrideDirective(componentType: Type, from: Type, to: Type): TestComponentBuilder;
|
overrideDirective(componentType: Type<any>, from: Type<any>, to: Type<any>): TestComponentBuilder;
|
||||||
overrideProviders(type: Type, providers: any[]): TestComponentBuilder;
|
overrideProviders(type: Type<any>, providers: any[]): TestComponentBuilder;
|
||||||
overrideTemplate(componentType: Type, template: string): TestComponentBuilder;
|
overrideTemplate(componentType: Type<any>, template: string): TestComponentBuilder;
|
||||||
overrideView(componentType: Type, view: ViewMetadata): TestComponentBuilder;
|
overrideView(componentType: Type<any>, view: ViewMetadata): TestComponentBuilder;
|
||||||
overrideViewProviders(type: Type, providers: any[]): TestComponentBuilder;
|
overrideViewProviders(type: Type<any>, providers: any[]): TestComponentBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
|
|
|
@ -141,10 +141,10 @@ export interface Form {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare const FORM_DIRECTIVES: Type[][];
|
export declare const FORM_DIRECTIVES: Type<any>[][];
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare const FORM_PROVIDERS: Type[];
|
export declare const FORM_PROVIDERS: Type<any>[];
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare class FormArray extends AbstractControl {
|
export declare class FormArray extends AbstractControl {
|
||||||
|
@ -433,10 +433,10 @@ export declare class PatternValidator implements Validator {
|
||||||
export declare function provideForms(): any[];
|
export declare function provideForms(): any[];
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare const REACTIVE_FORM_DIRECTIVES: Type[][];
|
export declare const REACTIVE_FORM_DIRECTIVES: Type<any>[][];
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare const REACTIVE_FORM_PROVIDERS: Type[];
|
export declare const REACTIVE_FORM_PROVIDERS: Type<any>[];
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare class ReactiveFormsModule {
|
export declare class ReactiveFormsModule {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
export declare function bootstrap<C>(appComponentType: ConcreteType<C>, customProviders?: Array<any>): Promise<ComponentRef<C>>;
|
export declare function bootstrap<C>(appComponentType: Type<C>, customProviders?: Array<any>): Promise<ComponentRef<C>>;
|
||||||
|
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
export declare function bootstrapWorkerApp<T>(appComponentType: ConcreteType<T>, customProviders?: Array<any>): Promise<ComponentRef<T>>;
|
export declare function bootstrapWorkerApp<T>(appComponentType: Type<T>, customProviders?: Array<any>): Promise<ComponentRef<T>>;
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare function bootstrapWorkerUi(workerScriptUri: string, customProviders?: Array<any>): Promise<PlatformRef>;
|
export declare function bootstrapWorkerUi(workerScriptUri: string, customProviders?: Array<any>): Promise<PlatformRef>;
|
||||||
|
|
|
@ -42,12 +42,12 @@ export declare class BrowserPlatformLocation extends PlatformLocation {
|
||||||
export declare class By {
|
export declare class By {
|
||||||
static all(): Predicate<DebugElement>;
|
static all(): Predicate<DebugElement>;
|
||||||
static css(selector: string): Predicate<DebugElement>;
|
static css(selector: string): Predicate<DebugElement>;
|
||||||
static directive(type: Type): Predicate<DebugElement>;
|
static directive(type: Type<any>): Predicate<DebugElement>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare abstract class ClientMessageBroker {
|
export declare abstract class ClientMessageBroker {
|
||||||
abstract runOnService(args: UiArguments, returnType: Type): Promise<any>;
|
abstract runOnService(args: UiArguments, returnType: Type<any>): Promise<any>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
|
@ -87,9 +87,9 @@ export declare class EventManager {
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare class FnArg {
|
export declare class FnArg {
|
||||||
type: Type;
|
type: Type<any>;
|
||||||
value: any;
|
value: any;
|
||||||
constructor(value: any, type: Type);
|
constructor(value: any, type: Type<any>);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
|
@ -136,7 +136,7 @@ export declare const platformWorkerApp: (extraProviders?: any[]) => PlatformRef;
|
||||||
export declare const platformWorkerUi: (extraProviders?: any[]) => PlatformRef;
|
export declare const platformWorkerUi: (extraProviders?: any[]) => PlatformRef;
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare const PRIMITIVE: Type;
|
export declare const PRIMITIVE: Type<any>;
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare class ReceivedMessage {
|
export declare class ReceivedMessage {
|
||||||
|
@ -171,7 +171,7 @@ export interface SafeUrl extends SafeValue {
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare abstract class ServiceMessageBroker {
|
export declare abstract class ServiceMessageBroker {
|
||||||
abstract registerMethod(methodName: string, signature: Type[], method: Function, returnType?: Type): void;
|
abstract registerMethod(methodName: string, signature: Type<any>[], method: Function, returnType?: Type<any>): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
|
|
|
@ -8,7 +8,7 @@ export declare const platformServer: (extraProviders?: any[]) => PlatformRef;
|
||||||
export declare const SERVER_PLATFORM_PROVIDERS: Array<any>;
|
export declare const SERVER_PLATFORM_PROVIDERS: Array<any>;
|
||||||
|
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
export declare function serverBootstrap<T>(appComponentType: ConcreteType<T>, customProviders: Array<any>): Promise<ComponentRef<T>>;
|
export declare function serverBootstrap<T>(appComponentType: Type<T>, customProviders: Array<any>): Promise<ComponentRef<T>>;
|
||||||
|
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
export declare const serverDynamicPlatform: (extraProviders?: any[]) => PlatformRef;
|
export declare const serverDynamicPlatform: (extraProviders?: any[]) => PlatformRef;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export declare class ActivatedRoute {
|
export declare class ActivatedRoute {
|
||||||
children: ActivatedRoute[];
|
children: ActivatedRoute[];
|
||||||
component: Type | string;
|
component: Type<any> | string;
|
||||||
data: Observable<Data>;
|
data: Observable<Data>;
|
||||||
firstChild: ActivatedRoute;
|
firstChild: ActivatedRoute;
|
||||||
fragment: Observable<string>;
|
fragment: Observable<string>;
|
||||||
|
@ -20,7 +20,7 @@ export declare class ActivatedRoute {
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export declare class ActivatedRouteSnapshot {
|
export declare class ActivatedRouteSnapshot {
|
||||||
children: ActivatedRouteSnapshot[];
|
children: ActivatedRouteSnapshot[];
|
||||||
component: Type | string;
|
component: Type<any> | string;
|
||||||
data: Data;
|
data: Data;
|
||||||
firstChild: ActivatedRouteSnapshot;
|
firstChild: ActivatedRouteSnapshot;
|
||||||
fragment: string;
|
fragment: string;
|
||||||
|
@ -153,7 +153,7 @@ export interface Route {
|
||||||
canDeactivate?: any[];
|
canDeactivate?: any[];
|
||||||
canLoad?: any[];
|
canLoad?: any[];
|
||||||
children?: Route[];
|
children?: Route[];
|
||||||
component?: Type | string;
|
component?: Type<any> | string;
|
||||||
data?: Data;
|
data?: Data;
|
||||||
loadChildren?: string;
|
loadChildren?: string;
|
||||||
outlet?: string;
|
outlet?: string;
|
||||||
|
@ -170,7 +170,7 @@ export declare class Router {
|
||||||
/** @experimental */ navigated: boolean;
|
/** @experimental */ navigated: boolean;
|
||||||
routerState: RouterState;
|
routerState: RouterState;
|
||||||
url: string;
|
url: string;
|
||||||
constructor(rootComponentType: Type, resolver: ComponentResolver, urlSerializer: UrlSerializer, outletMap: RouterOutletMap, location: Location, injector: Injector, loader: NgModuleFactoryLoader, config: Routes);
|
constructor(rootComponentType: Type<any>, resolver: ComponentResolver, urlSerializer: UrlSerializer, outletMap: RouterOutletMap, location: Location, injector: Injector, loader: NgModuleFactoryLoader, config: Routes);
|
||||||
createUrlTree(commands: any[], {relativeTo, queryParams, fragment, preserveQueryParams, preserveFragment}?: NavigationExtras): UrlTree;
|
createUrlTree(commands: any[], {relativeTo, queryParams, fragment, preserveQueryParams, preserveFragment}?: NavigationExtras): UrlTree;
|
||||||
dispose(): void;
|
dispose(): void;
|
||||||
initialNavigation(): void;
|
initialNavigation(): void;
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare class UpgradeAdapter {
|
export declare class UpgradeAdapter {
|
||||||
constructor(ng2AppModule?: Type);
|
constructor(ng2AppModule?: Type<any>);
|
||||||
/** @deprecated */ addProvider(provider: Type | Provider | any[] | any): void;
|
/** @deprecated */ addProvider(provider: Type<any> | Provider | any[] | any): void;
|
||||||
bootstrap(element: Element, modules?: any[], config?: angular.IAngularBootstrapConfig): UpgradeAdapterRef;
|
bootstrap(element: Element, modules?: any[], config?: angular.IAngularBootstrapConfig): UpgradeAdapterRef;
|
||||||
downgradeNg2Component(type: Type): Function;
|
downgradeNg2Component(type: Type<any>): Function;
|
||||||
downgradeNg2Provider(token: any): Function;
|
downgradeNg2Provider(token: any): Function;
|
||||||
upgradeNg1Component(name: string): Type;
|
upgradeNg1Component(name: string): Type<any>;
|
||||||
upgradeNg1Provider(name: string, options?: {
|
upgradeNg1Provider(name: string, options?: {
|
||||||
asToken: any;
|
asToken: any;
|
||||||
}): void;
|
}): void;
|
||||||
|
|
Loading…
Reference in New Issue