refactor: rename all const to UPPER_CASE
Closes #3573 BREAKING CHANGE Rename: - `appComponentTypeToken` => `APP_COMPONENT` - `coreDirectives` => `CORE_DIRECTIVES` - `formDirectives` => `FORM_DIRECTIVES` - `formInjectables` => `FORM_BINDINGS` - `httpInjectables` => `HTTP_BINDINGS` - `jsonpInjectables` => `JSONP_BINDINGS` - `PROTO_CHANGE_DETECTOR_KEY` => `PROTO_CHANGE_DETECTOR` - `appComponentRefPromiseToken` => `APP_COMPONENT_REF_PROMISE` - `appComponentTypeToken` => `APP_COMPONENT` - `undefinedValue` => `UNDEFINED` - `formDirectives` => `FORM_DIRECTIVES` - `DOCUMENT_TOKEN` => `DOCUMENT` - `APP_ID_TOKEN` => `APP_ID` - `MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE_TOKEN` => `MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE` - `appBaseHrefToken` => `APP_BASE_HREF`
This commit is contained in:
parent
1d65b38b28
commit
60af19f0e1
|
@ -3,7 +3,7 @@
|
|||
* @description
|
||||
* Define angular core API here.
|
||||
*/
|
||||
export {appComponentTypeToken} from 'angular2/src/core/application_tokens';
|
||||
export {APP_COMPONENT} from 'angular2/src/core/application_tokens';
|
||||
export {ApplicationRef} from 'angular2/src/core/application_common';
|
||||
export {Type} from 'angular2/src/facade/lang';
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ export {
|
|||
PUBLIC_AND_PRIVATE,
|
||||
PUBLIC,
|
||||
PRIVATE,
|
||||
undefinedValue
|
||||
UNDEFINED
|
||||
} from './src/di/injector';
|
||||
export {Binding, BindingBuilder, ResolvedBinding, Dependency, bind} from './src/di/binding';
|
||||
export {Key, KeyRegistry, TypeLiteral} from './src/di/key';
|
||||
|
|
|
@ -60,5 +60,5 @@ export * from './src/directives/ng_switch';
|
|||
* ```
|
||||
*
|
||||
*/
|
||||
export const coreDirectives: List<Type> =
|
||||
export const CORE_DIRECTIVES: List<Type> =
|
||||
CONST_EXPR([NgClass, NgFor, NgIf, NgNonBindable, NgSwitch, NgSwitchWhen, NgSwitchDefault]);
|
||||
|
|
|
@ -31,7 +31,7 @@ export {
|
|||
NgSelectOption,
|
||||
SelectControlValueAccessor
|
||||
} from './src/forms/directives/select_control_value_accessor';
|
||||
export {formDirectives} from './src/forms/directives';
|
||||
export {FORM_DIRECTIVES} from './src/forms/directives';
|
||||
export {Validators} from './src/forms/validators';
|
||||
export {NgValidator, NgRequiredValidator} from './src/forms/directives/validators';
|
||||
export {FormBuilder} from './src/forms/form_builder';
|
||||
|
@ -39,4 +39,4 @@ export {FormBuilder} from './src/forms/form_builder';
|
|||
import {FormBuilder} from './src/forms/form_builder';
|
||||
import {CONST_EXPR, Type} from './src/facade/lang';
|
||||
|
||||
export const formInjectables: List<Type> = CONST_EXPR([FormBuilder]);
|
||||
export const FORM_BINDINGS: List<Type> = CONST_EXPR([FormBuilder]);
|
||||
|
|
|
@ -15,8 +15,8 @@ export {
|
|||
RenderFragmentRef,
|
||||
RenderViewWithFragments,
|
||||
ViewDefinition,
|
||||
DOCUMENT_TOKEN,
|
||||
APP_ID_TOKEN,
|
||||
DOCUMENT,
|
||||
APP_ID,
|
||||
DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES,
|
||||
MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE_TOKEN
|
||||
MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE
|
||||
} from './src/render/render';
|
||||
|
|
|
@ -13,7 +13,7 @@ export {RouteRegistry} from './src/router/route_registry';
|
|||
export {LocationStrategy} from './src/router/location_strategy';
|
||||
export {HashLocationStrategy} from './src/router/hash_location_strategy';
|
||||
export {HTML5LocationStrategy} from './src/router/html5_location_strategy';
|
||||
export {Location, appBaseHrefToken} from './src/router/location';
|
||||
export {Location, APP_BASE_HREF} from './src/router/location';
|
||||
export {Pipeline} from './src/router/pipeline';
|
||||
export * from './src/router/route_config_decorator';
|
||||
export * from './src/router/route_definition';
|
||||
|
@ -31,7 +31,7 @@ import {RouterLink} from './src/router/router_link';
|
|||
import {RouteRegistry} from './src/router/route_registry';
|
||||
import {Pipeline} from './src/router/pipeline';
|
||||
import {Location} from './src/router/location';
|
||||
import {appComponentTypeToken} from './src/core/application_tokens';
|
||||
import {APP_COMPONENT} from './src/core/application_tokens';
|
||||
import {bind} from './di';
|
||||
import {CONST_EXPR} from './src/facade/lang';
|
||||
import {List} from './src/facade/collection';
|
||||
|
@ -46,5 +46,5 @@ export var routerInjectables: List<any> = [
|
|||
bind(Router)
|
||||
.toFactory((registry, pipeline, location,
|
||||
appRoot) => { return new RootRouter(registry, pipeline, location, appRoot);},
|
||||
[RouteRegistry, Pipeline, Location, appComponentTypeToken])
|
||||
[RouteRegistry, Pipeline, Location, APP_COMPONENT])
|
||||
];
|
||||
|
|
|
@ -72,7 +72,7 @@ export const defaultKeyValueDiffers = CONST_EXPR(new KeyValueDiffers(keyValDiff)
|
|||
// dart2js. See https://github.com/dart-lang/sdk/issues/23630 for details.
|
||||
export var preGeneratedProtoDetectors: StringMap<string, Function> = {};
|
||||
|
||||
export const PROTO_CHANGE_DETECTOR_KEY = CONST_EXPR(new OpaqueToken('ProtoChangeDetectors'));
|
||||
export const PROTO_CHANGE_DETECTOR = CONST_EXPR(new OpaqueToken('ProtoChangeDetectors'));
|
||||
|
||||
/**
|
||||
* Implements change detection using a map of pregenerated proto detectors.
|
||||
|
@ -82,7 +82,7 @@ export class PreGeneratedChangeDetection extends ChangeDetection {
|
|||
_dynamicChangeDetection: ChangeDetection;
|
||||
_protoChangeDetectorFactories: StringMap<string, Function>;
|
||||
|
||||
constructor(@Inject(PROTO_CHANGE_DETECTOR_KEY) @Optional() protoChangeDetectorsForTest?:
|
||||
constructor(@Inject(PROTO_CHANGE_DETECTOR) @Optional() protoChangeDetectorsForTest?:
|
||||
StringMap<string, Function>) {
|
||||
super();
|
||||
this._dynamicChangeDetection = new DynamicChangeDetection();
|
||||
|
|
|
@ -60,11 +60,11 @@ import {ProtoViewFactory} from 'angular2/src/core/compiler/proto_view_factory';
|
|||
import {Renderer, RenderCompiler} from 'angular2/src/render/api';
|
||||
import {
|
||||
DomRenderer,
|
||||
DOCUMENT_TOKEN,
|
||||
DOCUMENT,
|
||||
DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES,
|
||||
DefaultDomCompiler,
|
||||
APP_ID_RANDOM_BINDING,
|
||||
MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE_TOKEN,
|
||||
MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE,
|
||||
TemplateCloner
|
||||
} from 'angular2/src/render/render';
|
||||
import {ElementSchemaRegistry} from 'angular2/src/render/dom/schema/element_schema_registry';
|
||||
|
@ -74,7 +74,7 @@ import {
|
|||
DomSharedStylesHost
|
||||
} from 'angular2/src/render/dom/view/shared_styles_host';
|
||||
import {internalView} from 'angular2/src/core/compiler/view_ref';
|
||||
import {appComponentRefPromiseToken, appComponentTypeToken} from './application_tokens';
|
||||
import {APP_COMPONENT_REF_PROMISE, APP_COMPONENT} from './application_tokens';
|
||||
import {wtfInit} from '../profile/wtf_init';
|
||||
|
||||
var _rootInjector: Injector;
|
||||
|
@ -90,11 +90,11 @@ function _injectorBindings(appComponentType): List<Type | Binding | List<any>> {
|
|||
bestChangeDetection = JitChangeDetection;
|
||||
}
|
||||
return [
|
||||
bind(DOCUMENT_TOKEN)
|
||||
bind(DOCUMENT)
|
||||
.toValue(DOM.defaultDoc()),
|
||||
bind(DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES).toValue(false),
|
||||
bind(appComponentTypeToken).toValue(appComponentType),
|
||||
bind(appComponentRefPromiseToken)
|
||||
bind(APP_COMPONENT).toValue(appComponentType),
|
||||
bind(APP_COMPONENT_REF_PROMISE)
|
||||
.toFactory(
|
||||
(dynamicComponentLoader, injector, testability, registry) => {
|
||||
// TODO(rado): investigate whether to support bindings on root component.
|
||||
|
@ -107,7 +107,7 @@ function _injectorBindings(appComponentType): List<Type | Binding | List<any>> {
|
|||
[DynamicComponentLoader, Injector, Testability, TestabilityRegistry]),
|
||||
|
||||
bind(appComponentType)
|
||||
.toFactory((p: Promise<any>) => p.then(ref => ref.instance), [appComponentRefPromiseToken]),
|
||||
.toFactory((p: Promise<any>) => p.then(ref => ref.instance), [APP_COMPONENT_REF_PROMISE]),
|
||||
bind(LifeCycle).toFactory((exceptionHandler) => new LifeCycle(null, assertionsEnabled()),
|
||||
[ExceptionHandler]),
|
||||
bind(EventManager)
|
||||
|
@ -122,7 +122,7 @@ function _injectorBindings(appComponentType): List<Type | Binding | List<any>> {
|
|||
bind(Renderer).toAlias(DomRenderer),
|
||||
APP_ID_RANDOM_BINDING,
|
||||
TemplateCloner,
|
||||
bind(MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE_TOKEN).toValue(20),
|
||||
bind(MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE).toValue(20),
|
||||
DefaultDomCompiler,
|
||||
bind(ElementSchemaRegistry).toValue(new DomElementSchemaRegistry()),
|
||||
bind(RenderCompiler).toAlias(DefaultDomCompiler),
|
||||
|
@ -305,7 +305,7 @@ export function commonBootstrap(
|
|||
exceptionHandler = appInjector.get(ExceptionHandler);
|
||||
zone.overrideOnErrorHandler((e, s) => exceptionHandler.call(e, s));
|
||||
|
||||
var compRefToken: Promise<any> = appInjector.get(appComponentRefPromiseToken);
|
||||
var compRefToken: Promise<any> = appInjector.get(APP_COMPONENT_REF_PROMISE);
|
||||
var tick = (componentRef) => {
|
||||
var appChangeDetector = internalView(componentRef.hostView).changeDetector;
|
||||
// retrieve life cycle: may have already been created if injected in root component
|
||||
|
|
|
@ -4,7 +4,7 @@ import {CONST_EXPR} from 'angular2/src/facade/lang';
|
|||
/**
|
||||
* @private
|
||||
*/
|
||||
export const appComponentRefPromiseToken = CONST_EXPR(new OpaqueToken('Promise<ComponentRef>'));
|
||||
export const APP_COMPONENT_REF_PROMISE = CONST_EXPR(new OpaqueToken('Promise<ComponentRef>'));
|
||||
|
||||
/**
|
||||
* An opaque token representing the application root type in the {@link Injector}.
|
||||
|
@ -22,4 +22,4 @@ export const appComponentRefPromiseToken = CONST_EXPR(new OpaqueToken('Promise<C
|
|||
*
|
||||
* ```
|
||||
*/
|
||||
export const appComponentTypeToken: OpaqueToken = CONST_EXPR(new OpaqueToken('RootComponent'));
|
||||
export const APP_COMPONENT: OpaqueToken = CONST_EXPR(new OpaqueToken('AppComponent'));
|
||||
|
|
|
@ -15,7 +15,7 @@ import {
|
|||
PUBLIC_AND_PRIVATE,
|
||||
PUBLIC,
|
||||
PRIVATE,
|
||||
undefinedValue,
|
||||
UNDEFINED,
|
||||
Key,
|
||||
Dependency,
|
||||
bind,
|
||||
|
@ -645,7 +645,7 @@ export class ElementInjector extends TreeNode<ElementInjector> implements Depend
|
|||
}
|
||||
}
|
||||
|
||||
return undefinedValue;
|
||||
return UNDEFINED;
|
||||
}
|
||||
|
||||
private _buildAttribute(dep: DirectiveDependency): string {
|
||||
|
@ -892,41 +892,41 @@ class ElementInjectorInlineStrategy implements _ElementInjectorStrategy {
|
|||
var p = i.protoStrategy;
|
||||
i.resetConstructionCounter();
|
||||
|
||||
if (p.binding0 instanceof DirectiveBinding && isPresent(p.keyId0) && i.obj0 === undefinedValue)
|
||||
if (p.binding0 instanceof DirectiveBinding && isPresent(p.keyId0) && i.obj0 === UNDEFINED)
|
||||
i.obj0 = i.instantiateBinding(p.binding0, p.visibility0);
|
||||
if (p.binding1 instanceof DirectiveBinding && isPresent(p.keyId1) && i.obj1 === undefinedValue)
|
||||
if (p.binding1 instanceof DirectiveBinding && isPresent(p.keyId1) && i.obj1 === UNDEFINED)
|
||||
i.obj1 = i.instantiateBinding(p.binding1, p.visibility1);
|
||||
if (p.binding2 instanceof DirectiveBinding && isPresent(p.keyId2) && i.obj2 === undefinedValue)
|
||||
if (p.binding2 instanceof DirectiveBinding && isPresent(p.keyId2) && i.obj2 === UNDEFINED)
|
||||
i.obj2 = i.instantiateBinding(p.binding2, p.visibility2);
|
||||
if (p.binding3 instanceof DirectiveBinding && isPresent(p.keyId3) && i.obj3 === undefinedValue)
|
||||
if (p.binding3 instanceof DirectiveBinding && isPresent(p.keyId3) && i.obj3 === UNDEFINED)
|
||||
i.obj3 = i.instantiateBinding(p.binding3, p.visibility3);
|
||||
if (p.binding4 instanceof DirectiveBinding && isPresent(p.keyId4) && i.obj4 === undefinedValue)
|
||||
if (p.binding4 instanceof DirectiveBinding && isPresent(p.keyId4) && i.obj4 === UNDEFINED)
|
||||
i.obj4 = i.instantiateBinding(p.binding4, p.visibility4);
|
||||
if (p.binding5 instanceof DirectiveBinding && isPresent(p.keyId5) && i.obj5 === undefinedValue)
|
||||
if (p.binding5 instanceof DirectiveBinding && isPresent(p.keyId5) && i.obj5 === UNDEFINED)
|
||||
i.obj5 = i.instantiateBinding(p.binding5, p.visibility5);
|
||||
if (p.binding6 instanceof DirectiveBinding && isPresent(p.keyId6) && i.obj6 === undefinedValue)
|
||||
if (p.binding6 instanceof DirectiveBinding && isPresent(p.keyId6) && i.obj6 === UNDEFINED)
|
||||
i.obj6 = i.instantiateBinding(p.binding6, p.visibility6);
|
||||
if (p.binding7 instanceof DirectiveBinding && isPresent(p.keyId7) && i.obj7 === undefinedValue)
|
||||
if (p.binding7 instanceof DirectiveBinding && isPresent(p.keyId7) && i.obj7 === UNDEFINED)
|
||||
i.obj7 = i.instantiateBinding(p.binding7, p.visibility7);
|
||||
if (p.binding8 instanceof DirectiveBinding && isPresent(p.keyId8) && i.obj8 === undefinedValue)
|
||||
if (p.binding8 instanceof DirectiveBinding && isPresent(p.keyId8) && i.obj8 === UNDEFINED)
|
||||
i.obj8 = i.instantiateBinding(p.binding8, p.visibility8);
|
||||
if (p.binding9 instanceof DirectiveBinding && isPresent(p.keyId9) && i.obj9 === undefinedValue)
|
||||
if (p.binding9 instanceof DirectiveBinding && isPresent(p.keyId9) && i.obj9 === UNDEFINED)
|
||||
i.obj9 = i.instantiateBinding(p.binding9, p.visibility9);
|
||||
}
|
||||
|
||||
dehydrate() {
|
||||
var i = this.injectorStrategy;
|
||||
|
||||
i.obj0 = undefinedValue;
|
||||
i.obj1 = undefinedValue;
|
||||
i.obj2 = undefinedValue;
|
||||
i.obj3 = undefinedValue;
|
||||
i.obj4 = undefinedValue;
|
||||
i.obj5 = undefinedValue;
|
||||
i.obj6 = undefinedValue;
|
||||
i.obj7 = undefinedValue;
|
||||
i.obj8 = undefinedValue;
|
||||
i.obj9 = undefinedValue;
|
||||
i.obj0 = UNDEFINED;
|
||||
i.obj1 = UNDEFINED;
|
||||
i.obj2 = UNDEFINED;
|
||||
i.obj3 = UNDEFINED;
|
||||
i.obj4 = UNDEFINED;
|
||||
i.obj5 = UNDEFINED;
|
||||
i.obj6 = UNDEFINED;
|
||||
i.obj7 = UNDEFINED;
|
||||
i.obj8 = UNDEFINED;
|
||||
i.obj9 = UNDEFINED;
|
||||
}
|
||||
|
||||
callOnDestroy(): void {
|
||||
|
@ -1012,43 +1012,43 @@ class ElementInjectorInlineStrategy implements _ElementInjectorStrategy {
|
|||
var p = i.protoStrategy;
|
||||
|
||||
if (isPresent(p.binding0) && p.binding0.key.token === query.selector) {
|
||||
if (i.obj0 === undefinedValue) i.obj0 = i.instantiateBinding(p.binding0, p.visibility0);
|
||||
if (i.obj0 === UNDEFINED) i.obj0 = i.instantiateBinding(p.binding0, p.visibility0);
|
||||
list.push(i.obj0);
|
||||
}
|
||||
if (isPresent(p.binding1) && p.binding1.key.token === query.selector) {
|
||||
if (i.obj1 === undefinedValue) i.obj1 = i.instantiateBinding(p.binding1, p.visibility1);
|
||||
if (i.obj1 === UNDEFINED) i.obj1 = i.instantiateBinding(p.binding1, p.visibility1);
|
||||
list.push(i.obj1);
|
||||
}
|
||||
if (isPresent(p.binding2) && p.binding2.key.token === query.selector) {
|
||||
if (i.obj2 === undefinedValue) i.obj2 = i.instantiateBinding(p.binding2, p.visibility2);
|
||||
if (i.obj2 === UNDEFINED) i.obj2 = i.instantiateBinding(p.binding2, p.visibility2);
|
||||
list.push(i.obj2);
|
||||
}
|
||||
if (isPresent(p.binding3) && p.binding3.key.token === query.selector) {
|
||||
if (i.obj3 === undefinedValue) i.obj3 = i.instantiateBinding(p.binding3, p.visibility3);
|
||||
if (i.obj3 === UNDEFINED) i.obj3 = i.instantiateBinding(p.binding3, p.visibility3);
|
||||
list.push(i.obj3);
|
||||
}
|
||||
if (isPresent(p.binding4) && p.binding4.key.token === query.selector) {
|
||||
if (i.obj4 === undefinedValue) i.obj4 = i.instantiateBinding(p.binding4, p.visibility4);
|
||||
if (i.obj4 === UNDEFINED) i.obj4 = i.instantiateBinding(p.binding4, p.visibility4);
|
||||
list.push(i.obj4);
|
||||
}
|
||||
if (isPresent(p.binding5) && p.binding5.key.token === query.selector) {
|
||||
if (i.obj5 === undefinedValue) i.obj5 = i.instantiateBinding(p.binding5, p.visibility5);
|
||||
if (i.obj5 === UNDEFINED) i.obj5 = i.instantiateBinding(p.binding5, p.visibility5);
|
||||
list.push(i.obj5);
|
||||
}
|
||||
if (isPresent(p.binding6) && p.binding6.key.token === query.selector) {
|
||||
if (i.obj6 === undefinedValue) i.obj6 = i.instantiateBinding(p.binding6, p.visibility6);
|
||||
if (i.obj6 === UNDEFINED) i.obj6 = i.instantiateBinding(p.binding6, p.visibility6);
|
||||
list.push(i.obj6);
|
||||
}
|
||||
if (isPresent(p.binding7) && p.binding7.key.token === query.selector) {
|
||||
if (i.obj7 === undefinedValue) i.obj7 = i.instantiateBinding(p.binding7, p.visibility7);
|
||||
if (i.obj7 === UNDEFINED) i.obj7 = i.instantiateBinding(p.binding7, p.visibility7);
|
||||
list.push(i.obj7);
|
||||
}
|
||||
if (isPresent(p.binding8) && p.binding8.key.token === query.selector) {
|
||||
if (i.obj8 === undefinedValue) i.obj8 = i.instantiateBinding(p.binding8, p.visibility8);
|
||||
if (i.obj8 === UNDEFINED) i.obj8 = i.instantiateBinding(p.binding8, p.visibility8);
|
||||
list.push(i.obj8);
|
||||
}
|
||||
if (isPresent(p.binding9) && p.binding9.key.token === query.selector) {
|
||||
if (i.obj9 === undefinedValue) i.obj9 = i.instantiateBinding(p.binding9, p.visibility9);
|
||||
if (i.obj9 === UNDEFINED) i.obj9 = i.instantiateBinding(p.binding9, p.visibility9);
|
||||
list.push(i.obj9);
|
||||
}
|
||||
}
|
||||
|
@ -1072,7 +1072,7 @@ class ElementInjectorDynamicStrategy implements _ElementInjectorStrategy {
|
|||
|
||||
for (var i = 0; i < p.keyIds.length; i++) {
|
||||
if (p.bindings[i] instanceof DirectiveBinding && isPresent(p.keyIds[i]) &&
|
||||
inj.objs[i] === undefinedValue) {
|
||||
inj.objs[i] === UNDEFINED) {
|
||||
inj.objs[i] = inj.instantiateBinding(p.bindings[i], p.visibilities[i]);
|
||||
}
|
||||
}
|
||||
|
@ -1080,7 +1080,7 @@ class ElementInjectorDynamicStrategy implements _ElementInjectorStrategy {
|
|||
|
||||
dehydrate(): void {
|
||||
var inj = this.injectorStrategy;
|
||||
ListWrapper.fill(inj.objs, undefinedValue);
|
||||
ListWrapper.fill(inj.objs, UNDEFINED);
|
||||
}
|
||||
|
||||
callOnDestroy(): void {
|
||||
|
@ -1119,7 +1119,7 @@ class ElementInjectorDynamicStrategy implements _ElementInjectorStrategy {
|
|||
|
||||
for (var i = 0; i < p.bindings.length; i++) {
|
||||
if (p.bindings[i].key.token === query.selector) {
|
||||
if (ist.objs[i] === undefinedValue) {
|
||||
if (ist.objs[i] === UNDEFINED) {
|
||||
ist.objs[i] = ist.instantiateBinding(p.bindings[i], p.visibilities[i]);
|
||||
}
|
||||
list.push(ist.objs[i]);
|
||||
|
|
|
@ -36,7 +36,7 @@ export class Dependency {
|
|||
const _EMPTY_LIST = CONST_EXPR([]);
|
||||
|
||||
/**
|
||||
* Describes how the {@link Injector} should instantiate a given token.
|
||||
* Describes how_ the {@link Injector} should instantiate a given token.
|
||||
*
|
||||
* See {@link bind}.
|
||||
*
|
||||
|
|
|
@ -16,7 +16,7 @@ import {SelfMetadata, HostMetadata, SkipSelfMetadata} from './metadata';
|
|||
// Threshold for the dynamic version
|
||||
const _MAX_CONSTRUCTION_COUNTER = 10;
|
||||
|
||||
export const undefinedValue: Object = CONST_EXPR(new Object());
|
||||
export const UNDEFINED: Object = CONST_EXPR(new Object());
|
||||
|
||||
export const PUBLIC: number = 1;
|
||||
export const PRIVATE: number = 2;
|
||||
|
@ -193,16 +193,16 @@ export interface InjectorStrategy {
|
|||
}
|
||||
|
||||
export class InjectorInlineStrategy implements InjectorStrategy {
|
||||
obj0: any = undefinedValue;
|
||||
obj1: any = undefinedValue;
|
||||
obj2: any = undefinedValue;
|
||||
obj3: any = undefinedValue;
|
||||
obj4: any = undefinedValue;
|
||||
obj5: any = undefinedValue;
|
||||
obj6: any = undefinedValue;
|
||||
obj7: any = undefinedValue;
|
||||
obj8: any = undefinedValue;
|
||||
obj9: any = undefinedValue;
|
||||
obj0: any = UNDEFINED;
|
||||
obj1: any = UNDEFINED;
|
||||
obj2: any = UNDEFINED;
|
||||
obj3: any = UNDEFINED;
|
||||
obj4: any = UNDEFINED;
|
||||
obj5: any = UNDEFINED;
|
||||
obj6: any = UNDEFINED;
|
||||
obj7: any = UNDEFINED;
|
||||
obj8: any = UNDEFINED;
|
||||
obj9: any = UNDEFINED;
|
||||
|
||||
constructor(public injector: Injector, public protoStrategy: ProtoInjectorInlineStrategy) {}
|
||||
|
||||
|
@ -223,67 +223,67 @@ export class InjectorInlineStrategy implements InjectorStrategy {
|
|||
var inj = this.injector;
|
||||
|
||||
if (p.keyId0 === keyId && (p.visibility0 & visibility) > 0) {
|
||||
if (this.obj0 === undefinedValue) {
|
||||
if (this.obj0 === UNDEFINED) {
|
||||
this.obj0 = inj._new(p.binding0, p.visibility0);
|
||||
}
|
||||
return this.obj0;
|
||||
}
|
||||
if (p.keyId1 === keyId && (p.visibility1 & visibility) > 0) {
|
||||
if (this.obj1 === undefinedValue) {
|
||||
if (this.obj1 === UNDEFINED) {
|
||||
this.obj1 = inj._new(p.binding1, p.visibility1);
|
||||
}
|
||||
return this.obj1;
|
||||
}
|
||||
if (p.keyId2 === keyId && (p.visibility2 & visibility) > 0) {
|
||||
if (this.obj2 === undefinedValue) {
|
||||
if (this.obj2 === UNDEFINED) {
|
||||
this.obj2 = inj._new(p.binding2, p.visibility2);
|
||||
}
|
||||
return this.obj2;
|
||||
}
|
||||
if (p.keyId3 === keyId && (p.visibility3 & visibility) > 0) {
|
||||
if (this.obj3 === undefinedValue) {
|
||||
if (this.obj3 === UNDEFINED) {
|
||||
this.obj3 = inj._new(p.binding3, p.visibility3);
|
||||
}
|
||||
return this.obj3;
|
||||
}
|
||||
if (p.keyId4 === keyId && (p.visibility4 & visibility) > 0) {
|
||||
if (this.obj4 === undefinedValue) {
|
||||
if (this.obj4 === UNDEFINED) {
|
||||
this.obj4 = inj._new(p.binding4, p.visibility4);
|
||||
}
|
||||
return this.obj4;
|
||||
}
|
||||
if (p.keyId5 === keyId && (p.visibility5 & visibility) > 0) {
|
||||
if (this.obj5 === undefinedValue) {
|
||||
if (this.obj5 === UNDEFINED) {
|
||||
this.obj5 = inj._new(p.binding5, p.visibility5);
|
||||
}
|
||||
return this.obj5;
|
||||
}
|
||||
if (p.keyId6 === keyId && (p.visibility6 & visibility) > 0) {
|
||||
if (this.obj6 === undefinedValue) {
|
||||
if (this.obj6 === UNDEFINED) {
|
||||
this.obj6 = inj._new(p.binding6, p.visibility6);
|
||||
}
|
||||
return this.obj6;
|
||||
}
|
||||
if (p.keyId7 === keyId && (p.visibility7 & visibility) > 0) {
|
||||
if (this.obj7 === undefinedValue) {
|
||||
if (this.obj7 === UNDEFINED) {
|
||||
this.obj7 = inj._new(p.binding7, p.visibility7);
|
||||
}
|
||||
return this.obj7;
|
||||
}
|
||||
if (p.keyId8 === keyId && (p.visibility8 & visibility) > 0) {
|
||||
if (this.obj8 === undefinedValue) {
|
||||
if (this.obj8 === UNDEFINED) {
|
||||
this.obj8 = inj._new(p.binding8, p.visibility8);
|
||||
}
|
||||
return this.obj8;
|
||||
}
|
||||
if (p.keyId9 === keyId && (p.visibility9 & visibility) > 0) {
|
||||
if (this.obj9 === undefinedValue) {
|
||||
if (this.obj9 === UNDEFINED) {
|
||||
this.obj9 = inj._new(p.binding9, p.visibility9);
|
||||
}
|
||||
return this.obj9;
|
||||
}
|
||||
|
||||
return undefinedValue;
|
||||
return UNDEFINED;
|
||||
}
|
||||
|
||||
getObjAtIndex(index: number): any {
|
||||
|
@ -309,7 +309,7 @@ export class InjectorDynamicStrategy implements InjectorStrategy {
|
|||
|
||||
constructor(public protoStrategy: ProtoInjectorDynamicStrategy, public injector: Injector) {
|
||||
this.objs = ListWrapper.createFixedSize(protoStrategy.bindings.length);
|
||||
ListWrapper.fill(this.objs, undefinedValue);
|
||||
ListWrapper.fill(this.objs, UNDEFINED);
|
||||
}
|
||||
|
||||
resetConstructionCounter(): void { this.injector._constructionCounter = 0; }
|
||||
|
@ -329,7 +329,7 @@ export class InjectorDynamicStrategy implements InjectorStrategy {
|
|||
|
||||
for (var i = 0; i < p.keyIds.length; i++) {
|
||||
if (p.keyIds[i] === keyId && (p.visibilities[i] & visibility) > 0) {
|
||||
if (this.objs[i] === undefinedValue) {
|
||||
if (this.objs[i] === UNDEFINED) {
|
||||
this.objs[i] = this.injector._new(p.bindings[i], p.visibilities[i]);
|
||||
}
|
||||
|
||||
|
@ -337,7 +337,7 @@ export class InjectorDynamicStrategy implements InjectorStrategy {
|
|||
}
|
||||
}
|
||||
|
||||
return undefinedValue;
|
||||
return UNDEFINED;
|
||||
}
|
||||
|
||||
getObjAtIndex(index: number): any {
|
||||
|
@ -693,8 +693,8 @@ export class Injector {
|
|||
bindingVisibility: number): any {
|
||||
var special = isPresent(this._depProvider) ?
|
||||
this._depProvider.getDependency(this, binding, dep) :
|
||||
undefinedValue;
|
||||
if (special !== undefinedValue) {
|
||||
UNDEFINED;
|
||||
if (special !== UNDEFINED) {
|
||||
return special;
|
||||
} else {
|
||||
return this._getByKey(dep.key, dep.lowerBoundVisibility, dep.upperBoundVisibility,
|
||||
|
@ -729,7 +729,7 @@ export class Injector {
|
|||
|
||||
_getByKeySelf(key: Key, optional: boolean, bindingVisibility: number): any {
|
||||
var obj = this._strategy.getObjByKeyId(key.id, bindingVisibility);
|
||||
return (obj !== undefinedValue) ? obj : this._throwOrNull(key, optional);
|
||||
return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, optional);
|
||||
}
|
||||
|
||||
_getByKeyHost(key: Key, optional: boolean, bindingVisibility: number,
|
||||
|
@ -746,7 +746,7 @@ export class Injector {
|
|||
|
||||
while (inj != null) {
|
||||
var obj = inj._strategy.getObjByKeyId(key.id, bindingVisibility);
|
||||
if (obj !== undefinedValue) return obj;
|
||||
if (obj !== UNDEFINED) return obj;
|
||||
|
||||
if (isPresent(inj._parent) && inj._isHost) {
|
||||
return this._getPrivateDependency(key, optional, inj);
|
||||
|
@ -760,7 +760,7 @@ export class Injector {
|
|||
|
||||
_getPrivateDependency(key: Key, optional: boolean, inj: Injector): any {
|
||||
var obj = inj._parent._strategy.getObjByKeyId(key.id, PRIVATE);
|
||||
return (obj !== undefinedValue) ? obj : this._throwOrNull(key, optional);
|
||||
return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, optional);
|
||||
}
|
||||
|
||||
_getByKeyDefault(key: Key, optional: boolean, bindingVisibility: number,
|
||||
|
@ -774,7 +774,7 @@ export class Injector {
|
|||
|
||||
while (inj != null) {
|
||||
var obj = inj._strategy.getObjByKeyId(key.id, bindingVisibility);
|
||||
if (obj !== undefinedValue) return obj;
|
||||
if (obj !== UNDEFINED) return obj;
|
||||
|
||||
bindingVisibility = inj._isHost ? PUBLIC_AND_PRIVATE : PUBLIC;
|
||||
inj = inj._parent;
|
||||
|
|
|
@ -35,7 +35,7 @@ export {NgValidator, NgRequiredValidator} from './directives/validators';
|
|||
*
|
||||
* This is a shorthand for importing them each individually.
|
||||
*/
|
||||
export const formDirectives: List<Type> = CONST_EXPR([
|
||||
export const FORM_DIRECTIVES: List<Type> = CONST_EXPR([
|
||||
NgControlName,
|
||||
NgControlGroup,
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ const controlGroupBinding =
|
|||
* ```
|
||||
* @Component({selector: "signup-comp"})
|
||||
* @View({
|
||||
* directives: [formDirectives],
|
||||
* directives: [FORM_DIRECTIVES],
|
||||
* template: `
|
||||
* <form #f="form" (submit)='onSignUp(f.value)'>
|
||||
* <div ng-control-group='credentials' #credentials="form">
|
||||
|
|
|
@ -29,7 +29,7 @@ const controlNameBinding =
|
|||
* ```
|
||||
* @Component({selector: "login-comp"})
|
||||
* @View({
|
||||
* directives: [formDirectives],
|
||||
* directives: [FORM_DIRECTIVES],
|
||||
* template: `
|
||||
* <form #f="form" (submit)='onLogIn(f.value)'>
|
||||
* Login <input type='text' ng-control='login' #l="form">
|
||||
|
@ -52,7 +52,7 @@ const controlNameBinding =
|
|||
* ```
|
||||
* @Component({selector: "login-comp"})
|
||||
* @View({
|
||||
* directives: [formDirectives],
|
||||
* directives: [FORM_DIRECTIVES],
|
||||
* template: `
|
||||
* <form (submit)='onLogIn()'>
|
||||
* Login <input type='text' ng-control='login' [(ng-model)]="credentials.login">
|
||||
|
|
|
@ -26,7 +26,7 @@ const formDirectiveBinding =
|
|||
* ```
|
||||
* @Component({selector: "signup-comp"})
|
||||
* @View({
|
||||
* directives: [formDirectives],
|
||||
* directives: [FORM_DIRECTIVES],
|
||||
* template: `
|
||||
* <form #f="form" (submit)='onSignUp(f.value)'>
|
||||
* <div ng-control-group='credentials' #credentials="form">
|
||||
|
|
|
@ -27,7 +27,7 @@ const formControlBinding =
|
|||
* ```
|
||||
* @Component({selector: "login-comp"})
|
||||
* @View({
|
||||
* directives: [formDirectives],
|
||||
* directives: [FORM_DIRECTIVES],
|
||||
* template: "<input type='text' [ng-form-control]='loginControl'>"
|
||||
* })
|
||||
* class LoginComp {
|
||||
|
@ -45,7 +45,7 @@ const formControlBinding =
|
|||
* ```
|
||||
* @Component({selector: "login-comp"})
|
||||
* @View({
|
||||
* directives: [formDirectives],
|
||||
* directives: [FORM_DIRECTIVES],
|
||||
* template: "<input type='text' [ng-form-control]='loginControl' [(ng-model)]='login'>"
|
||||
* })
|
||||
* class LoginComp {
|
||||
|
|
|
@ -26,7 +26,7 @@ const formDirectiveBinding =
|
|||
* ```
|
||||
* @Component({selector: "login-comp"})
|
||||
* @View({
|
||||
* directives: [formDirectives],
|
||||
* directives: [FORM_DIRECTIVES],
|
||||
* template: "<form [ng-form-model]='loginForm'>" +
|
||||
* "Login <input type='text' ng-control='login'>" +
|
||||
* "Password <input type='password' ng-control='password'>" +
|
||||
|
@ -55,7 +55,7 @@ const formDirectiveBinding =
|
|||
* ```
|
||||
* @Component({selector: "login-comp"})
|
||||
* @View({
|
||||
* directives: [formDirectives],
|
||||
* directives: [FORM_DIRECTIVES],
|
||||
* template: "<form [ng-form-model]='loginForm'>" +
|
||||
* "Login <input type='text' ng-control='login' [(ng-model)]='login'>" +
|
||||
* "Password <input type='password' ng-control='password' [(ng-model)]='password'>" +
|
||||
|
|
|
@ -19,7 +19,7 @@ const formControlBinding = CONST_EXPR(new Binding(NgControl, {toAlias: forwardRe
|
|||
* ```
|
||||
* @Component({selector: "search-comp"})
|
||||
* @View({
|
||||
* directives: [formDirectives],
|
||||
* directives: [FORM_DIRECTIVES],
|
||||
* template: `
|
||||
<input type='text' [(ng-model)]="searchQuery">
|
||||
* `})
|
||||
|
|
|
@ -11,7 +11,7 @@ import * as modelModule from './model';
|
|||
*
|
||||
* ```
|
||||
* import {Component, View, bootstrap} from 'angular2/angular2';
|
||||
* import {FormBuilder, Validators, formDirectives, ControlGroup} from 'angular2/forms';
|
||||
* import {FormBuilder, Validators, FORM_DIRECTIVES, ControlGroup} from 'angular2/forms';
|
||||
*
|
||||
* @Component({
|
||||
* selector: 'login-comp',
|
||||
|
@ -31,7 +31,7 @@ import * as modelModule from './model';
|
|||
* </form>
|
||||
* `,
|
||||
* directives: [
|
||||
* formDirectives
|
||||
* FORM_DIRECTIVES
|
||||
* ]
|
||||
* })
|
||||
* class LoginComp {
|
||||
|
|
|
@ -21,7 +21,7 @@ import {ElementSchemaRegistry} from '../schema/element_schema_registry';
|
|||
import {Parser} from 'angular2/src/change_detection/change_detection';
|
||||
import * as pvm from '../view/proto_view_merger';
|
||||
import {CssSelector} from './selector';
|
||||
import {DOCUMENT_TOKEN, APP_ID_TOKEN} from '../dom_tokens';
|
||||
import {DOCUMENT, APP_ID} from '../dom_tokens';
|
||||
import {Inject} from 'angular2/di';
|
||||
import {SharedStylesHost} from '../view/shared_styles_host';
|
||||
import {prependAll} from '../util';
|
||||
|
@ -126,7 +126,7 @@ export class DomCompiler extends RenderCompiler {
|
|||
export class DefaultDomCompiler extends DomCompiler {
|
||||
constructor(schemaRegistry: ElementSchemaRegistry, templateCloner: TemplateCloner, parser: Parser,
|
||||
viewLoader: ViewLoader, sharedStylesHost: SharedStylesHost,
|
||||
@Inject(APP_ID_TOKEN) appId: any) {
|
||||
@Inject(APP_ID) appId: any) {
|
||||
super(schemaRegistry, templateCloner, new DefaultStepFactory(parser, appId), viewLoader,
|
||||
sharedStylesHost);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ import {
|
|||
|
||||
import {TemplateCloner} from './template_cloner';
|
||||
|
||||
import {DOCUMENT_TOKEN, DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES} from './dom_tokens';
|
||||
import {DOCUMENT, DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES} from './dom_tokens';
|
||||
|
||||
const REFLECT_PREFIX: string = 'ng-reflect-';
|
||||
|
||||
|
@ -47,7 +47,7 @@ export class DomRenderer extends Renderer {
|
|||
|
||||
constructor(private _eventManager: EventManager,
|
||||
private _domSharedStylesHost: DomSharedStylesHost,
|
||||
private _templateCloner: TemplateCloner, @Inject(DOCUMENT_TOKEN) document,
|
||||
private _templateCloner: TemplateCloner, @Inject(DOCUMENT) document,
|
||||
@Inject(DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES) reflectPropertiesAsAttributes:
|
||||
boolean) {
|
||||
super();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {OpaqueToken, bind, Binding} from 'angular2/di';
|
||||
import {OpaqueToken, Binding} from 'angular2/di';
|
||||
import {CONST_EXPR, StringWrapper, Math} from 'angular2/src/facade/lang';
|
||||
|
||||
export const DOCUMENT_TOKEN: OpaqueToken = CONST_EXPR(new OpaqueToken('DocumentToken'));
|
||||
export const DOCUMENT: OpaqueToken = CONST_EXPR(new OpaqueToken('DocumentToken'));
|
||||
|
||||
export const DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES: OpaqueToken =
|
||||
CONST_EXPR(new OpaqueToken('DomReflectPropertiesAsAttributes'));
|
||||
|
@ -10,19 +10,23 @@ export const DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES: OpaqueToken =
|
|||
/**
|
||||
* A unique id (string) for an angular application.
|
||||
*/
|
||||
export const APP_ID_TOKEN: OpaqueToken = CONST_EXPR(new OpaqueToken('AppId'));
|
||||
export const APP_ID: OpaqueToken = CONST_EXPR(new OpaqueToken('AppId'));
|
||||
|
||||
function _appIdRandomBindingFactory() {
|
||||
return `${randomChar()}${randomChar()}${randomChar()}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bindings that will generate a random APP_ID_TOKEN.
|
||||
*/
|
||||
export var APP_ID_RANDOM_BINDING: Binding =
|
||||
bind(APP_ID_TOKEN).toFactory(() => `${randomChar()}${randomChar()}${randomChar()}`, []);
|
||||
export const APP_ID_RANDOM_BINDING: Binding =
|
||||
CONST_EXPR(new Binding(APP_ID, {toFactory: _appIdRandomBindingFactory, deps: []}));
|
||||
|
||||
/**
|
||||
* Defines when a compiled template should be stored as a string
|
||||
* rather than keeping its Nodes to preserve memory.
|
||||
*/
|
||||
export const MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE_TOKEN: OpaqueToken =
|
||||
export const MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE: OpaqueToken =
|
||||
CONST_EXPR(new OpaqueToken('MaxInMemoryElementsPerTemplate'));
|
||||
|
||||
function randomChar(): string {
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import {isString} from 'angular2/src/facade/lang';
|
||||
import {Injectable, Inject} from 'angular2/di';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
import {MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE_TOKEN} from './dom_tokens';
|
||||
import {MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE} from './dom_tokens';
|
||||
|
||||
@Injectable()
|
||||
export class TemplateCloner {
|
||||
maxInMemoryElementsPerTemplate: number;
|
||||
|
||||
constructor(@Inject(MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE_TOKEN) maxInMemoryElementsPerTemplate) {
|
||||
constructor(@Inject(MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE) maxInMemoryElementsPerTemplate) {
|
||||
this.maxInMemoryElementsPerTemplate = maxInMemoryElementsPerTemplate;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
import {Inject, Injectable} from 'angular2/di';
|
||||
import {SetWrapper} from 'angular2/src/facade/collection';
|
||||
import {DOCUMENT_TOKEN} from '../dom_tokens';
|
||||
import {DOCUMENT} from '../dom_tokens';
|
||||
|
||||
@Injectable()
|
||||
export class SharedStylesHost {
|
||||
|
@ -30,7 +30,7 @@ export class SharedStylesHost {
|
|||
@Injectable()
|
||||
export class DomSharedStylesHost extends SharedStylesHost {
|
||||
private _hostNodes: Set<Node> = new Set();
|
||||
constructor(@Inject(DOCUMENT_TOKEN) doc: any) {
|
||||
constructor(@Inject(DOCUMENT) doc: any) {
|
||||
super();
|
||||
this._hostNodes.add(doc.head);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import {EventEmitter, ObservableWrapper} from 'angular2/src/facade/async';
|
|||
import {BaseException, isBlank} from 'angular2/src/facade/lang';
|
||||
import {OpaqueToken, Injectable, Optional, Inject} from 'angular2/di';
|
||||
|
||||
export const appBaseHrefToken: OpaqueToken = CONST_EXPR(new OpaqueToken('locationHrefToken'));
|
||||
export const APP_BASE_HREF: OpaqueToken = CONST_EXPR(new OpaqueToken('appBaseHref'));
|
||||
|
||||
/**
|
||||
* This is the service that an application developer will directly interact with.
|
||||
|
@ -22,7 +22,7 @@ export class Location {
|
|||
private _baseHref: string;
|
||||
|
||||
constructor(public _platformStrategy: LocationStrategy,
|
||||
@Optional() @Inject(appBaseHrefToken) href?: string) {
|
||||
@Optional() @Inject(APP_BASE_HREF) href?: string) {
|
||||
var browserBaseHref = isPresent(href) ? href : this._platformStrategy.getBaseHref();
|
||||
|
||||
if (isBlank(browserBaseHref)) {
|
||||
|
|
|
@ -4,7 +4,7 @@ import {isBlank, isPresent} from 'angular2/src/facade/lang';
|
|||
|
||||
import {Directive, Attribute} from 'angular2/src/core/annotations/decorators';
|
||||
import {DynamicComponentLoader, ComponentRef, ElementRef} from 'angular2/core';
|
||||
import {Injector, bind, Dependency, undefinedValue} from 'angular2/di';
|
||||
import {Injector, bind, Dependency, UNDEFINED} from 'angular2/di';
|
||||
|
||||
import * as routerMod from './router';
|
||||
import {Instruction, ComponentInstruction, RouteParams} from './instruction';
|
||||
|
|
|
@ -16,7 +16,7 @@ import {
|
|||
|
||||
import {el} from './utils';
|
||||
|
||||
import {DOCUMENT_TOKEN} from 'angular2/src/render/render';
|
||||
import {DOCUMENT} from 'angular2/src/render/render';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
|
||||
import {DebugElement} from 'angular2/src/debug/debug_element';
|
||||
|
@ -135,7 +135,7 @@ export class TestComponentBuilder {
|
|||
|
||||
var rootElId = `root${_nextRootElementId++}`;
|
||||
var rootEl = el(`<div id="${rootElId}"></div>`);
|
||||
var doc = this._injector.get(DOCUMENT_TOKEN);
|
||||
var doc = this._injector.get(DOCUMENT);
|
||||
|
||||
// TODO(juliemr): can/should this be optional?
|
||||
var oldRoots = DOM.querySelectorAll(doc, '[id^=root]');
|
||||
|
|
|
@ -53,13 +53,13 @@ import {ProtoViewFactory} from 'angular2/src/core/compiler/proto_view_factory';
|
|||
import {RenderCompiler, Renderer} from 'angular2/src/render/api';
|
||||
import {
|
||||
DomRenderer,
|
||||
DOCUMENT_TOKEN,
|
||||
DOCUMENT,
|
||||
DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES,
|
||||
DefaultDomCompiler,
|
||||
APP_ID_TOKEN,
|
||||
APP_ID,
|
||||
SharedStylesHost,
|
||||
DomSharedStylesHost,
|
||||
MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE_TOKEN,
|
||||
MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE,
|
||||
TemplateCloner
|
||||
} from 'angular2/src/render/render';
|
||||
import {ElementSchemaRegistry} from 'angular2/src/render/dom/schema/element_schema_registry';
|
||||
|
@ -99,13 +99,13 @@ function _getAppBindings() {
|
|||
}
|
||||
|
||||
return [
|
||||
bind(DOCUMENT_TOKEN)
|
||||
bind(DOCUMENT)
|
||||
.toValue(appDoc),
|
||||
DomRenderer,
|
||||
bind(Renderer).toAlias(DomRenderer),
|
||||
bind(APP_ID_TOKEN).toValue('a'),
|
||||
bind(APP_ID).toValue('a'),
|
||||
TemplateCloner,
|
||||
bind(MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE_TOKEN).toValue(-1),
|
||||
bind(MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE).toValue(-1),
|
||||
DefaultDomCompiler,
|
||||
bind(RenderCompiler).toAlias(DefaultDomCompiler),
|
||||
bind(ElementSchemaRegistry).toValue(new DomElementSchemaRegistry()),
|
||||
|
|
|
@ -23,11 +23,11 @@ import {Renderer, RenderCompiler} from 'angular2/src/render/api';
|
|||
import {AppRootUrl} from 'angular2/src/services/app_root_url';
|
||||
import {
|
||||
DomRenderer,
|
||||
DOCUMENT_TOKEN,
|
||||
DOCUMENT,
|
||||
DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES,
|
||||
DefaultDomCompiler,
|
||||
APP_ID_RANDOM_BINDING,
|
||||
MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE_TOKEN,
|
||||
MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE,
|
||||
TemplateCloner
|
||||
} from 'angular2/src/render/render';
|
||||
import {ElementSchemaRegistry} from 'angular2/src/render/dom/schema/element_schema_registry';
|
||||
|
@ -79,7 +79,7 @@ function _injectorBindings(): List<Type | Binding | List<any>> {
|
|||
}
|
||||
|
||||
return [
|
||||
bind(DOCUMENT_TOKEN)
|
||||
bind(DOCUMENT)
|
||||
.toValue(DOM.defaultDoc()),
|
||||
bind(EventManager)
|
||||
.toFactory(
|
||||
|
@ -94,7 +94,7 @@ function _injectorBindings(): List<Type | Binding | List<any>> {
|
|||
bind(Renderer).toAlias(DomRenderer),
|
||||
APP_ID_RANDOM_BINDING,
|
||||
TemplateCloner,
|
||||
bind(MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE_TOKEN).toValue(20),
|
||||
bind(MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE).toValue(20),
|
||||
DefaultDomCompiler,
|
||||
bind(RenderCompiler).toAlias(DefaultDomCompiler),
|
||||
DomSharedStylesHost,
|
||||
|
|
|
@ -54,10 +54,7 @@ import {internalView} from 'angular2/src/core/compiler/view_ref';
|
|||
|
||||
import {MessageBroker} from 'angular2/src/web-workers/worker/broker';
|
||||
import {WebWorkerMessageBus} from 'angular2/src/web-workers/worker/application';
|
||||
import {
|
||||
appComponentRefPromiseToken,
|
||||
appComponentTypeToken
|
||||
} from 'angular2/src/core/application_tokens';
|
||||
import {APP_COMPONENT_REF_PROMISE, APP_COMPONENT} from 'angular2/src/core/application_tokens';
|
||||
import {ApplicationRef} from 'angular2/src/core/application';
|
||||
import {createNgZone} from 'angular2/src/core/application_common';
|
||||
import {Serializer} from "angular2/src/web-workers/shared/serializer";
|
||||
|
@ -87,9 +84,9 @@ function _injectorBindings(appComponentType, bus: WebWorkerMessageBus,
|
|||
bestChangeDetection = JitChangeDetection;
|
||||
}
|
||||
return [
|
||||
bind(appComponentTypeToken)
|
||||
bind(APP_COMPONENT)
|
||||
.toValue(appComponentType),
|
||||
bind(appComponentRefPromiseToken)
|
||||
bind(APP_COMPONENT_REF_PROMISE)
|
||||
.toFactory(
|
||||
(dynamicComponentLoader, injector) => {
|
||||
|
||||
|
@ -99,7 +96,7 @@ function _injectorBindings(appComponentType, bus: WebWorkerMessageBus,
|
|||
},
|
||||
[DynamicComponentLoader, Injector]),
|
||||
|
||||
bind(appComponentType).toFactory((ref) => ref.instance, [appComponentRefPromiseToken]),
|
||||
bind(appComponentType).toFactory((ref) => ref.instance, [APP_COMPONENT_REF_PROMISE]),
|
||||
bind(LifeCycle).toFactory((exceptionHandler) => new LifeCycle(null, assertionsEnabled()),
|
||||
[ExceptionHandler]),
|
||||
Serializer,
|
||||
|
@ -163,7 +160,7 @@ export function bootstrapWebWorkerCommon(
|
|||
message["data"]["value"]);
|
||||
var compRefToken = PromiseWrapper.wrap(() => {
|
||||
try {
|
||||
return appInjector.get(appComponentRefPromiseToken);
|
||||
return appInjector.get(APP_COMPONENT_REF_PROMISE);
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import {bind, Inject, Injector} from 'angular2/di';
|
|||
import {LifeCycle} from 'angular2/core';
|
||||
import {ExceptionHandler} from 'angular2/src/core/exception_handler';
|
||||
import {Testability, TestabilityRegistry} from 'angular2/src/core/testability/testability';
|
||||
import {DOCUMENT_TOKEN} from 'angular2/src/render/render';
|
||||
import {DOCUMENT} from 'angular2/src/render/render';
|
||||
|
||||
@Component({selector: 'hello-app'})
|
||||
@View({template: '{{greeting}} world!'})
|
||||
|
@ -87,7 +87,7 @@ export function main() {
|
|||
DOM.appendChild(fakeDoc.body, el2);
|
||||
DOM.appendChild(el, lightDom);
|
||||
DOM.setText(lightDom, 'loading');
|
||||
testBindings = [bind(DOCUMENT_TOKEN).toValue(fakeDoc)];
|
||||
testBindings = [bind(DOCUMENT).toValue(fakeDoc)];
|
||||
});
|
||||
|
||||
it('should throw if bootstrapped Directive is not a Component',
|
||||
|
|
|
@ -24,7 +24,7 @@ import {Component, View, LifecycleEvent} from 'angular2/annotations';
|
|||
import * as viewAnn from 'angular2/src/core/annotations_impl/view';
|
||||
import {DynamicComponentLoader} from 'angular2/src/core/compiler/dynamic_component_loader';
|
||||
import {ElementRef} from 'angular2/src/core/compiler/element_ref';
|
||||
import {DOCUMENT_TOKEN} from 'angular2/src/render/render';
|
||||
import {DOCUMENT} from 'angular2/src/render/render';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
|
||||
export function main() {
|
||||
|
@ -218,7 +218,7 @@ export function main() {
|
|||
|
||||
describe('loadAsRoot', () => {
|
||||
it('should allow to create, update and destroy components',
|
||||
inject([AsyncTestCompleter, DynamicComponentLoader, DOCUMENT_TOKEN, Injector],
|
||||
inject([AsyncTestCompleter, DynamicComponentLoader, DOCUMENT, Injector],
|
||||
(async, loader, doc, injector) => {
|
||||
var rootEl = el('<child-cmp></child-cmp>');
|
||||
DOM.appendChild(doc.body, rootEl);
|
||||
|
|
|
@ -38,7 +38,7 @@ import {
|
|||
ViewEncapsulation
|
||||
} from 'angular2/angular2';
|
||||
|
||||
import {MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE_TOKEN} from 'angular2/src/render/render';
|
||||
import {MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE} from 'angular2/src/render/render';
|
||||
|
||||
export function main() {
|
||||
describe('projection', () => {
|
||||
|
@ -445,12 +445,12 @@ export function main() {
|
|||
}
|
||||
|
||||
describe('serialize templates', () => {
|
||||
beforeEachBindings(() => [bind(MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE_TOKEN).toValue(0)]);
|
||||
beforeEachBindings(() => [bind(MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE).toValue(0)]);
|
||||
runTests();
|
||||
});
|
||||
|
||||
describe("don't serialize templates", () => {
|
||||
beforeEachBindings(() => [bind(MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE_TOKEN).toValue(-1)]);
|
||||
beforeEachBindings(() => [bind(MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE).toValue(-1)]);
|
||||
runTests();
|
||||
});
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import {
|
|||
Control,
|
||||
ControlGroup,
|
||||
NgForm,
|
||||
formDirectives,
|
||||
FORM_DIRECTIVES,
|
||||
Validators,
|
||||
NgControl,
|
||||
ControlValueAccessor
|
||||
|
@ -770,7 +770,7 @@ class WrappedValue implements ControlValueAccessor {
|
|||
}
|
||||
|
||||
@Component({selector: "my-comp"})
|
||||
@View({directives: [formDirectives, WrappedValue, NgIf, NgFor]})
|
||||
@View({directives: [FORM_DIRECTIVES, WrappedValue, NgIf, NgFor]})
|
||||
class MyComp {
|
||||
form: any;
|
||||
name: string;
|
||||
|
|
|
@ -5,7 +5,7 @@ import {PromiseWrapper, Promise} from 'angular2/src/facade/async';
|
|||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
|
||||
import {DomRenderer} from 'angular2/src/render/dom/dom_renderer';
|
||||
import {DOCUMENT_TOKEN} from 'angular2/src/render/dom/dom_tokens';
|
||||
import {DOCUMENT} from 'angular2/src/render/dom/dom_tokens';
|
||||
import {DefaultDomCompiler} from 'angular2/src/render/dom/compiler/compiler';
|
||||
import {
|
||||
RenderViewWithFragments,
|
||||
|
@ -65,8 +65,7 @@ export class DomTestbed {
|
|||
compiler: DefaultDomCompiler;
|
||||
rootEl;
|
||||
|
||||
constructor(renderer: DomRenderer, compiler: DefaultDomCompiler,
|
||||
@Inject(DOCUMENT_TOKEN) document) {
|
||||
constructor(renderer: DomRenderer, compiler: DefaultDomCompiler, @Inject(DOCUMENT) document) {
|
||||
this.renderer = renderer;
|
||||
this.compiler = compiler;
|
||||
this.rootEl = el('<div id="root" class="rootElem"></div>');
|
||||
|
|
|
@ -14,7 +14,7 @@ import {
|
|||
|
||||
import {Injector, bind} from 'angular2/di';
|
||||
import {CONST_EXPR} from 'angular2/src/facade/lang';
|
||||
import {Location, appBaseHrefToken} from 'angular2/src/router/location';
|
||||
import {Location, APP_BASE_HREF} from 'angular2/src/router/location';
|
||||
import {LocationStrategy} from 'angular2/src/router/location_strategy';
|
||||
import {MockLocationStrategy} from 'angular2/src/mock/mock_location_strategy';
|
||||
|
||||
|
@ -71,7 +71,7 @@ export function main() {
|
|||
});
|
||||
|
||||
it('should use optional base href param', () => {
|
||||
let location = makeLocation('/', bind(appBaseHrefToken).toValue('/my/custom/href'));
|
||||
let location = makeLocation('/', bind(APP_BASE_HREF).toValue('/my/custom/href'));
|
||||
location.go('user/btford');
|
||||
expect(locationStrategy.path()).toEqual('/my/custom/href/user/btford');
|
||||
});
|
||||
|
|
|
@ -15,14 +15,14 @@ import {bootstrap} from 'angular2/bootstrap';
|
|||
import {Component, Directive, View} from 'angular2/annotations';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
import {bind} from 'angular2/di';
|
||||
import {DOCUMENT_TOKEN} from 'angular2/src/render/render';
|
||||
import {DOCUMENT} from 'angular2/src/render/render';
|
||||
import {Type} from 'angular2/src/facade/lang';
|
||||
|
||||
import {
|
||||
routerInjectables,
|
||||
Router,
|
||||
RouteConfig,
|
||||
appBaseHrefToken,
|
||||
APP_BASE_HREF,
|
||||
routerDirectives
|
||||
} from 'angular2/router';
|
||||
|
||||
|
@ -49,7 +49,7 @@ export function main() {
|
|||
testBindings = [
|
||||
routerInjectables,
|
||||
bind(LocationStrategy).toClass(MockLocationStrategy),
|
||||
bind(DOCUMENT_TOKEN).toValue(fakeDoc),
|
||||
bind(DOCUMENT).toValue(fakeDoc),
|
||||
bind(ExceptionHandler).toValue(exceptionHandler)
|
||||
];
|
||||
});
|
||||
|
|
|
@ -18,7 +18,7 @@ import {bootstrap} from 'angular2/src/core/application';
|
|||
import {Component, Directive, View} from 'angular2/src/core/annotations/decorators';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
import {bind} from 'angular2/di';
|
||||
import {DOCUMENT_TOKEN} from 'angular2/src/render/render';
|
||||
import {DOCUMENT} from 'angular2/src/render/render';
|
||||
import {RouteConfig, Route, Redirect} from 'angular2/src/router/route_config_decorator';
|
||||
import {PromiseWrapper} from 'angular2/src/facade/async';
|
||||
import {BaseException} from 'angular2/src/facade/lang';
|
||||
|
@ -26,14 +26,14 @@ import {
|
|||
routerInjectables,
|
||||
RouteParams,
|
||||
Router,
|
||||
appBaseHrefToken,
|
||||
APP_BASE_HREF,
|
||||
routerDirectives,
|
||||
HashLocationStrategy
|
||||
} from 'angular2/router';
|
||||
|
||||
import {LocationStrategy} from 'angular2/src/router/location_strategy';
|
||||
import {MockLocationStrategy} from 'angular2/src/mock/mock_location_strategy';
|
||||
import {appComponentTypeToken} from 'angular2/src/core/application_tokens';
|
||||
import {APP_COMPONENT} from 'angular2/src/core/application_tokens';
|
||||
|
||||
export function main() {
|
||||
describe('router injectables', () => {
|
||||
|
@ -53,7 +53,7 @@ export function main() {
|
|||
[
|
||||
routerInjectables,
|
||||
bind(LocationStrategy).toClass(MockLocationStrategy),
|
||||
bind(DOCUMENT_TOKEN).toValue(fakeDoc)
|
||||
bind(DOCUMENT).toValue(fakeDoc)
|
||||
])
|
||||
.then((applicationRef) => {
|
||||
var router = applicationRef.hostComponent.router;
|
||||
|
@ -67,7 +67,7 @@ export function main() {
|
|||
});
|
||||
|
||||
describe('broken app', () => {
|
||||
beforeEachBindings(() => { return [bind(appComponentTypeToken).toValue(BrokenAppCmp)]; });
|
||||
beforeEachBindings(() => { return [bind(APP_COMPONENT).toValue(BrokenAppCmp)]; });
|
||||
|
||||
it('should rethrow exceptions from component constructors',
|
||||
inject([AsyncTestCompleter, TestComponentBuilder], (async, tcb: TestComponentBuilder) => {
|
||||
|
@ -83,7 +83,7 @@ export function main() {
|
|||
});
|
||||
|
||||
describe('back button app', () => {
|
||||
beforeEachBindings(() => { return [bind(appComponentTypeToken).toValue(HierarchyAppCmp)]; });
|
||||
beforeEachBindings(() => { return [bind(APP_COMPONENT).toValue(HierarchyAppCmp)]; });
|
||||
|
||||
it('should change the url without pushing a new history state for back navigations',
|
||||
inject([AsyncTestCompleter, TestComponentBuilder], (async, tcb: TestComponentBuilder) => {
|
||||
|
@ -134,7 +134,7 @@ export function main() {
|
|||
});
|
||||
|
||||
describe('hierarchical app', () => {
|
||||
beforeEachBindings(() => { return [bind(appComponentTypeToken).toValue(HierarchyAppCmp)]; });
|
||||
beforeEachBindings(() => { return [bind(APP_COMPONENT).toValue(HierarchyAppCmp)]; });
|
||||
|
||||
it('should bootstrap an app with a hierarchy',
|
||||
inject([AsyncTestCompleter, TestComponentBuilder], (async, tcb: TestComponentBuilder) => {
|
||||
|
@ -152,7 +152,7 @@ export function main() {
|
|||
}));
|
||||
|
||||
describe('custom app base ref', () => {
|
||||
beforeEachBindings(() => { return [bind(appBaseHrefToken).toValue('/my/app')]; });
|
||||
beforeEachBindings(() => { return [bind(APP_BASE_HREF).toValue('/my/app')]; });
|
||||
it('should bootstrap', inject([AsyncTestCompleter, TestComponentBuilder],
|
||||
(async, tcb: TestComponentBuilder) => {
|
||||
|
||||
|
@ -174,8 +174,7 @@ export function main() {
|
|||
// TODO: add a test in which the child component has bindings
|
||||
|
||||
describe('querystring params app', () => {
|
||||
beforeEachBindings(
|
||||
() => { return [bind(appComponentTypeToken).toValue(QueryStringAppCmp)]; });
|
||||
beforeEachBindings(() => { return [bind(APP_COMPONENT).toValue(QueryStringAppCmp)]; });
|
||||
|
||||
it('should recognize and return querystring params with the injected RouteParams',
|
||||
inject([AsyncTestCompleter, TestComponentBuilder], (async, tcb: TestComponentBuilder) => {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/// <reference path="../../../angular2/typings/rx/rx.d.ts" />
|
||||
|
||||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {httpInjectables} from 'http/http';
|
||||
import {HTTP_BINDINGS} from 'http/http';
|
||||
import {HttpCmp} from './http_comp';
|
||||
|
||||
export function main() {
|
||||
bootstrap(HttpCmp, [httpInjectables]);
|
||||
bootstrap(HttpCmp, [HTTP_BINDINGS]);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import {HttpCmp} from './http_comp';
|
||||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {httpInjectables} from 'http/http';
|
||||
import {HTTP_BINDINGS} from 'http/http';
|
||||
|
||||
export function main() {
|
||||
// This entry point is not transformed and exists for testing dynamic mode.
|
||||
bootstrap(HttpCmp, [httpInjectables]);
|
||||
bootstrap(HttpCmp, [HTTP_BINDINGS]);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/// <reference path="../../../angular2/typings/rx/rx.d.ts" />
|
||||
|
||||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {jsonpInjectables} from 'http/http';
|
||||
import {JSONP_BINDINGS} from 'http/http';
|
||||
import {JsonpCmp} from './jsonp_comp';
|
||||
|
||||
export function main() {
|
||||
bootstrap(JsonpCmp, [jsonpInjectables]);
|
||||
bootstrap(JsonpCmp, [JSONP_BINDINGS]);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {JsonpCmp} from './jsonp_comp';
|
||||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {jsonpInjectables} from 'http/http';
|
||||
import {JSONP_BINDINGS} from 'http/http';
|
||||
|
||||
export function main() {
|
||||
bootstrap(JsonpCmp, [jsonpInjectables]);
|
||||
bootstrap(JsonpCmp, [JSONP_BINDINGS]);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {bootstrap, NgIf, NgFor, Component, Directive, View, Host} from 'angular2/bootstrap';
|
||||
import {formDirectives, NgControl, Validators, NgFormModel, FormBuilder} from 'angular2/forms';
|
||||
import {FORM_DIRECTIVES, NgControl, Validators, NgFormModel, FormBuilder} from 'angular2/forms';
|
||||
|
||||
import {RegExpWrapper, print, isPresent} from 'angular2/src/facade/lang';
|
||||
|
||||
|
@ -117,7 +117,7 @@ class ShowError {
|
|||
<button type="submit" [disabled]="!f.form.valid">Submit</button>
|
||||
</form>
|
||||
`,
|
||||
directives: [formDirectives, NgFor, ShowError]
|
||||
directives: [FORM_DIRECTIVES, NgFor, ShowError]
|
||||
})
|
||||
class ModelDrivenForms {
|
||||
form;
|
||||
|
|
|
@ -14,7 +14,7 @@ import {
|
|||
|
||||
import {Injectable} from 'angular2/di';
|
||||
|
||||
import {formDirectives} from 'angular2/forms';
|
||||
import {FORM_DIRECTIVES} from 'angular2/forms';
|
||||
|
||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
||||
|
||||
|
@ -109,7 +109,7 @@ class DataService {
|
|||
<button (click)="select(order)">Select</button>
|
||||
</div>
|
||||
`,
|
||||
directives: [formDirectives, NgFor]
|
||||
directives: [FORM_DIRECTIVES, NgFor]
|
||||
})
|
||||
class OrderListComponent {
|
||||
orders: Order[];
|
||||
|
@ -143,7 +143,7 @@ class OrderListComponent {
|
|||
<button (click)="onDelete()">Delete</button>
|
||||
</div>
|
||||
`,
|
||||
directives: [formDirectives]
|
||||
directives: [FORM_DIRECTIVES]
|
||||
})
|
||||
class OrderItemComponent {
|
||||
item: OrderItem;
|
||||
|
@ -180,7 +180,7 @@ class OrderItemComponent {
|
|||
<order-item-cmp *ng-for="#item of order.items" [item]="item" (delete)="deleteItem(item)"></order-item-cmp>
|
||||
</div>
|
||||
`,
|
||||
directives: [formDirectives, OrderItemComponent, NgFor, NgIf]
|
||||
directives: [FORM_DIRECTIVES, OrderItemComponent, NgFor, NgIf]
|
||||
})
|
||||
class OrderDetailsComponent {
|
||||
constructor(private service: DataService) {}
|
||||
|
|
|
@ -13,7 +13,7 @@ import {
|
|||
|
||||
import {Injectable} from 'angular2/di';
|
||||
|
||||
import {formDirectives} from 'angular2/forms';
|
||||
import {FORM_DIRECTIVES} from 'angular2/forms';
|
||||
|
||||
import {CONST_EXPR} from 'angular2/src/facade/lang';
|
||||
|
||||
|
@ -113,7 +113,7 @@ class DataService {
|
|||
</form>
|
||||
</div>
|
||||
`,
|
||||
directives: [formDirectives]
|
||||
directives: [FORM_DIRECTIVES]
|
||||
})
|
||||
class FullNameComponent {
|
||||
constructor(private service: DataService) {}
|
||||
|
@ -161,7 +161,7 @@ class FullNameComponent {
|
|||
</form>
|
||||
</div>
|
||||
`,
|
||||
directives: [formDirectives, NgIf]
|
||||
directives: [FORM_DIRECTIVES, NgIf]
|
||||
})
|
||||
class PersonsDetailComponent {
|
||||
constructor(private service: DataService) {}
|
||||
|
@ -182,7 +182,7 @@ class PersonsDetailComponent {
|
|||
<person-detail-cmp></person-detail-cmp>
|
||||
</div>
|
||||
`,
|
||||
directives: [formDirectives, PersonsDetailComponent, NgFor]
|
||||
directives: [FORM_DIRECTIVES, PersonsDetailComponent, NgFor]
|
||||
})
|
||||
class PersonsComponent {
|
||||
persons: Person[];
|
||||
|
|
|
@ -2,7 +2,7 @@ import {InboxApp} from './inbox-app';
|
|||
import {bind} from 'angular2/angular2';
|
||||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {routerInjectables, HashLocationStrategy, LocationStrategy} from 'angular2/router';
|
||||
import {httpInjectables} from 'http/http';
|
||||
import {HTTP_BINDINGS} from 'http/http';
|
||||
|
||||
import {reflector} from 'angular2/src/reflection/reflection';
|
||||
import {ReflectionCapabilities} from 'angular2/src/reflection/reflection_capabilities';
|
||||
|
@ -11,5 +11,5 @@ export function main() {
|
|||
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
||||
bootstrap(
|
||||
InboxApp,
|
||||
[routerInjectables, httpInjectables, bind(LocationStrategy).toClass(HashLocationStrategy)]);
|
||||
[routerInjectables, HTTP_BINDINGS, bind(LocationStrategy).toClass(HashLocationStrategy)]);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import {
|
|||
forwardRef,
|
||||
Binding
|
||||
} from 'angular2/bootstrap';
|
||||
import {formDirectives, NgControl, Validators, NgForm} from 'angular2/forms';
|
||||
import {FORM_DIRECTIVES, NgControl, Validators, NgForm} from 'angular2/forms';
|
||||
|
||||
import {RegExpWrapper, print, isPresent, CONST_EXPR} from 'angular2/src/facade/lang';
|
||||
|
||||
|
@ -151,7 +151,7 @@ class ShowError {
|
|||
<button type="submit" [disabled]="!f.form.valid">Submit</button>
|
||||
</form>
|
||||
`,
|
||||
directives: [formDirectives, NgFor, CreditCardValidator, ShowError]
|
||||
directives: [FORM_DIRECTIVES, NgFor, CreditCardValidator, ShowError]
|
||||
})
|
||||
class TemplateDrivenForms {
|
||||
model = new CheckoutModel();
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import {NgZone, NgFor, Component, View, NgIf, formDirectives} from 'angular2/angular2';
|
||||
import {NgZone, NgFor, Component, View, NgIf, FORM_DIRECTIVES} from 'angular2/angular2';
|
||||
import {BitmapService} from './services/bitmap';
|
||||
import {EventListener} from 'angular2/src/facade/browser';
|
||||
import {FileReader, Uint8ArrayWrapper} from './file_api';
|
||||
import {TimerWrapper} from 'angular2/src/facade/async';
|
||||
|
||||
@Component({selector: 'image-demo', viewBindings: [BitmapService]})
|
||||
@View({templateUrl: 'image_demo.html', directives: [NgFor, NgIf, formDirectives]})
|
||||
@View({templateUrl: 'image_demo.html', directives: [NgFor, NgIf, FORM_DIRECTIVES]})
|
||||
export class ImageDemo {
|
||||
images = [];
|
||||
fileInput: String;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import {NgFor, Component, View, formDirectives} from 'angular2/angular2';
|
||||
import {NgFor, Component, View, FORM_DIRECTIVES} from 'angular2/angular2';
|
||||
import {Store, Todo, TodoFactory} from './services/TodoStore';
|
||||
|
||||
@Component({selector: 'todo-app', viewBindings: [Store, TodoFactory]})
|
||||
@View({templateUrl: 'todo.html', directives: [NgFor, formDirectives]})
|
||||
@View({templateUrl: 'todo.html', directives: [NgFor, FORM_DIRECTIVES]})
|
||||
export class TodoApp {
|
||||
todoEdit: Todo = null;
|
||||
inputValue: string;
|
||||
|
|
|
@ -50,8 +50,8 @@ export {URLSearchParams} from 'http/src/url_search_params';
|
|||
* #Example
|
||||
*
|
||||
* ```
|
||||
* import {httpInjectables, Http} from 'http/http';
|
||||
* @Component({selector: 'http-app', viewBindings: [httpInjectables]})
|
||||
* import {HTTP_BINDINGS, Http} from 'http/http';
|
||||
* @Component({selector: 'http-app', viewBindings: [HTTP_BINDINGS]})
|
||||
* @View({template: '{{data}}'})
|
||||
* class MyApp {
|
||||
* constructor(http:Http) {
|
||||
|
@ -61,7 +61,7 @@ export {URLSearchParams} from 'http/src/url_search_params';
|
|||
* ```
|
||||
*
|
||||
*/
|
||||
export var httpInjectables: List<any> = [
|
||||
export const HTTP_BINDINGS: List<any> = [
|
||||
bind(ConnectionBackend)
|
||||
.toClass(XHRBackend),
|
||||
BrowserXhr,
|
||||
|
@ -70,7 +70,7 @@ export var httpInjectables: List<any> = [
|
|||
Http
|
||||
];
|
||||
|
||||
export var jsonpInjectables: List<any> = [
|
||||
export const JSONP_BINDINGS: List<any> = [
|
||||
bind(ConnectionBackend)
|
||||
.toClass(JSONPBackend),
|
||||
BrowserJsonp,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require('reflect-metadata');
|
||||
require('traceur-runtime');
|
||||
import {httpInjectables, jsonpInjectables, Http, Jsonp} from './http';
|
||||
import {HTTP_BINDINGS, JSONP_BINDINGS, Http, Jsonp} from './http';
|
||||
import {Injector} from 'angular2/angular2';
|
||||
export * from './http';
|
||||
|
||||
|
@ -8,5 +8,5 @@ export * from './http';
|
|||
* TODO(jeffbcross): export each as their own top-level file, to require as:
|
||||
* require('http/http'); require('http/jsonp');
|
||||
*/
|
||||
export var http = Injector.resolveAndCreate([httpInjectables]).get(Http);
|
||||
export var jsonp = Injector.resolveAndCreate([jsonpInjectables]).get(Jsonp);
|
||||
export var http = Injector.resolveAndCreate([HTTP_BINDINGS]).get(Http);
|
||||
export var jsonp = Injector.resolveAndCreate([JSONP_BINDINGS]).get(Jsonp);
|
||||
|
|
|
@ -84,11 +84,10 @@ export class XHRConnection implements Connection {
|
|||
* #Example
|
||||
*
|
||||
* ```
|
||||
* import {Http, MyNodeBackend, httpInjectables, BaseRequestOptions} from
|
||||
*'angular2/http';
|
||||
* import {Http, MyNodeBackend, HTTP_BINDINGS, BaseRequestOptions} from 'http/http';
|
||||
* @Component({
|
||||
* viewBindings: [
|
||||
* httpInjectables,
|
||||
* HTTP_BINDINGS,
|
||||
* bind(Http).toFactory((backend, options) => {
|
||||
* return new Http(backend, options);
|
||||
* }, [MyNodeBackend, BaseRequestOptions])]
|
||||
|
|
|
@ -52,8 +52,8 @@ function mergeOptions(defaultOpts, providedOpts, method, url): RequestOptions {
|
|||
* #Example
|
||||
*
|
||||
* ```
|
||||
* import {Http, httpInjectables} from 'angular2/http';
|
||||
* @Component({selector: 'http-app', viewBindings: [httpInjectables]})
|
||||
* import {Http, HTTP_BINDINGS} from 'angular2/http';
|
||||
* @Component({selector: 'http-app', viewBindings: [HTTP_BINDINGS]})
|
||||
* @View({templateUrl: 'people.html'})
|
||||
* class PeopleComponent {
|
||||
* constructor(http: Http) {
|
||||
|
|
Loading…
Reference in New Issue