From 60af19f0e1e3377fe497c8591a1af44bd613ef66 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Mon, 10 Aug 2015 21:42:47 -0700 Subject: [PATCH] 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` --- modules/angular2/core.ts | 2 +- modules/angular2/di.ts | 2 +- modules/angular2/directives.ts | 2 +- modules/angular2/forms.ts | 4 +- modules/angular2/render.ts | 6 +- modules/angular2/router.ts | 6 +- .../src/change_detection/change_detection.ts | 4 +- .../angular2/src/core/application_common.ts | 18 ++--- .../angular2/src/core/application_tokens.ts | 4 +- .../src/core/compiler/element_injector.ts | 70 +++++++++---------- modules/angular2/src/di/binding.ts | 2 +- modules/angular2/src/di/injector.ts | 62 ++++++++-------- modules/angular2/src/forms/directives.ts | 2 +- .../src/forms/directives/ng_control_group.ts | 2 +- .../src/forms/directives/ng_control_name.ts | 4 +- .../angular2/src/forms/directives/ng_form.ts | 2 +- .../src/forms/directives/ng_form_control.ts | 4 +- .../src/forms/directives/ng_form_model.ts | 4 +- .../angular2/src/forms/directives/ng_model.ts | 2 +- modules/angular2/src/forms/form_builder.ts | 4 +- .../src/render/dom/compiler/compiler.ts | 4 +- .../angular2/src/render/dom/dom_renderer.ts | 4 +- modules/angular2/src/render/dom/dom_tokens.ts | 16 +++-- .../src/render/dom/template_cloner.ts | 4 +- .../src/render/dom/view/shared_styles_host.ts | 4 +- modules/angular2/src/router/location.ts | 4 +- modules/angular2/src/router/router_outlet.ts | 2 +- .../src/test_lib/test_component_builder.ts | 4 +- .../angular2/src/test_lib/test_injector.ts | 12 ++-- .../src/web-workers/ui/di_bindings.ts | 8 +-- .../web-workers/worker/application_common.ts | 13 ++-- .../angular2/test/core/application_spec.ts | 4 +- .../compiler/dynamic_component_loader_spec.ts | 4 +- .../compiler/projection_integration_spec.ts | 6 +- .../angular2/test/forms/integration_spec.ts | 4 +- .../angular2/test/render/dom/dom_testbed.ts | 5 +- modules/angular2/test/router/location_spec.ts | 4 +- .../angular2/test/router/route_config_spec.ts | 6 +- .../test/router/router_integration_spec.ts | 19 +++-- modules/examples/src/http/index.ts | 4 +- modules/examples/src/http/index_dynamic.ts | 4 +- modules/examples/src/jsonp/index.ts | 4 +- modules/examples/src/jsonp/index_dynamic.ts | 4 +- .../examples/src/model_driven_forms/index.ts | 4 +- .../examples/src/order_management/index.ts | 8 +-- .../examples/src/person_management/index.ts | 8 +-- modules/examples/src/routing/index.ts | 4 +- .../src/template_driven_forms/index.ts | 4 +- .../src/web_workers/images/index_common.ts | 4 +- .../src/web_workers/todo/index_common.ts | 4 +- modules/http/http.ts | 8 +-- modules/http/index.ts | 6 +- modules/http/src/backends/xhr_backend.ts | 5 +- modules/http/src/http.ts | 4 +- 54 files changed, 203 insertions(+), 205 deletions(-) diff --git a/modules/angular2/core.ts b/modules/angular2/core.ts index 4ac6b3f0a7b28..f1e398da9e73a 100644 --- a/modules/angular2/core.ts +++ b/modules/angular2/core.ts @@ -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'; diff --git a/modules/angular2/di.ts b/modules/angular2/di.ts index cde203677bd40..fdfed62c6ab99 100644 --- a/modules/angular2/di.ts +++ b/modules/angular2/di.ts @@ -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'; diff --git a/modules/angular2/directives.ts b/modules/angular2/directives.ts index 668450834249b..3665852673cc9 100644 --- a/modules/angular2/directives.ts +++ b/modules/angular2/directives.ts @@ -60,5 +60,5 @@ export * from './src/directives/ng_switch'; * ``` * */ -export const coreDirectives: List = +export const CORE_DIRECTIVES: List = CONST_EXPR([NgClass, NgFor, NgIf, NgNonBindable, NgSwitch, NgSwitchWhen, NgSwitchDefault]); diff --git a/modules/angular2/forms.ts b/modules/angular2/forms.ts index c3600169182c9..723f9ff1a36c6 100644 --- a/modules/angular2/forms.ts +++ b/modules/angular2/forms.ts @@ -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 = CONST_EXPR([FormBuilder]); +export const FORM_BINDINGS: List = CONST_EXPR([FormBuilder]); diff --git a/modules/angular2/render.ts b/modules/angular2/render.ts index e65fa9d0283bb..df60f7bcce960 100644 --- a/modules/angular2/render.ts +++ b/modules/angular2/render.ts @@ -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'; diff --git a/modules/angular2/router.ts b/modules/angular2/router.ts index 5dc032fc7ecff..d3c168949ad9d 100644 --- a/modules/angular2/router.ts +++ b/modules/angular2/router.ts @@ -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 = [ bind(Router) .toFactory((registry, pipeline, location, appRoot) => { return new RootRouter(registry, pipeline, location, appRoot);}, - [RouteRegistry, Pipeline, Location, appComponentTypeToken]) + [RouteRegistry, Pipeline, Location, APP_COMPONENT]) ]; diff --git a/modules/angular2/src/change_detection/change_detection.ts b/modules/angular2/src/change_detection/change_detection.ts index 99d511061834d..01345873feee7 100644 --- a/modules/angular2/src/change_detection/change_detection.ts +++ b/modules/angular2/src/change_detection/change_detection.ts @@ -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 = {}; -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; - constructor(@Inject(PROTO_CHANGE_DETECTOR_KEY) @Optional() protoChangeDetectorsForTest?: + constructor(@Inject(PROTO_CHANGE_DETECTOR) @Optional() protoChangeDetectorsForTest?: StringMap) { super(); this._dynamicChangeDetection = new DynamicChangeDetection(); diff --git a/modules/angular2/src/core/application_common.ts b/modules/angular2/src/core/application_common.ts index 13c9b441f5790..463e1f47155d4 100644 --- a/modules/angular2/src/core/application_common.ts +++ b/modules/angular2/src/core/application_common.ts @@ -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> { 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> { [DynamicComponentLoader, Injector, Testability, TestabilityRegistry]), bind(appComponentType) - .toFactory((p: Promise) => p.then(ref => ref.instance), [appComponentRefPromiseToken]), + .toFactory((p: Promise) => 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> { 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 = appInjector.get(appComponentRefPromiseToken); + var compRefToken: Promise = 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 diff --git a/modules/angular2/src/core/application_tokens.ts b/modules/angular2/src/core/application_tokens.ts index 6c2e5fc72bc66..9a35c8d66f647 100644 --- a/modules/angular2/src/core/application_tokens.ts +++ b/modules/angular2/src/core/application_tokens.ts @@ -4,7 +4,7 @@ import {CONST_EXPR} from 'angular2/src/facade/lang'; /** * @private */ -export const appComponentRefPromiseToken = CONST_EXPR(new OpaqueToken('Promise')); +export const APP_COMPONENT_REF_PROMISE = CONST_EXPR(new OpaqueToken('Promise')); /** * An opaque token representing the application root type in the {@link Injector}. @@ -22,4 +22,4 @@ export const appComponentRefPromiseToken = CONST_EXPR(new OpaqueToken('Promise 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]); diff --git a/modules/angular2/src/di/binding.ts b/modules/angular2/src/di/binding.ts index a842894ea0cbc..525760b542afd 100644 --- a/modules/angular2/src/di/binding.ts +++ b/modules/angular2/src/di/binding.ts @@ -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}. * diff --git a/modules/angular2/src/di/injector.ts b/modules/angular2/src/di/injector.ts index 285b9335a7ba2..588fc8c82ae65 100644 --- a/modules/angular2/src/di/injector.ts +++ b/modules/angular2/src/di/injector.ts @@ -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; diff --git a/modules/angular2/src/forms/directives.ts b/modules/angular2/src/forms/directives.ts index 8e43f1c1f09fd..d3d5fe645f8a2 100644 --- a/modules/angular2/src/forms/directives.ts +++ b/modules/angular2/src/forms/directives.ts @@ -35,7 +35,7 @@ export {NgValidator, NgRequiredValidator} from './directives/validators'; * * This is a shorthand for importing them each individually. */ -export const formDirectives: List = CONST_EXPR([ +export const FORM_DIRECTIVES: List = CONST_EXPR([ NgControlName, NgControlGroup, diff --git a/modules/angular2/src/forms/directives/ng_control_group.ts b/modules/angular2/src/forms/directives/ng_control_group.ts index 205d6765f73b9..dfd7785a1146d 100644 --- a/modules/angular2/src/forms/directives/ng_control_group.ts +++ b/modules/angular2/src/forms/directives/ng_control_group.ts @@ -24,7 +24,7 @@ const controlGroupBinding = * ``` * @Component({selector: "signup-comp"}) * @View({ - * directives: [formDirectives], + * directives: [FORM_DIRECTIVES], * template: ` *
*
diff --git a/modules/angular2/src/forms/directives/ng_control_name.ts b/modules/angular2/src/forms/directives/ng_control_name.ts index dd7258e492e12..9d9b644afc2f1 100644 --- a/modules/angular2/src/forms/directives/ng_control_name.ts +++ b/modules/angular2/src/forms/directives/ng_control_name.ts @@ -29,7 +29,7 @@ const controlNameBinding = * ``` * @Component({selector: "login-comp"}) * @View({ - * directives: [formDirectives], + * directives: [FORM_DIRECTIVES], * template: ` * * Login @@ -52,7 +52,7 @@ const controlNameBinding = * ``` * @Component({selector: "login-comp"}) * @View({ - * directives: [formDirectives], + * directives: [FORM_DIRECTIVES], * template: ` * * Login diff --git a/modules/angular2/src/forms/directives/ng_form.ts b/modules/angular2/src/forms/directives/ng_form.ts index dc06fe471164a..f24bede943de2 100644 --- a/modules/angular2/src/forms/directives/ng_form.ts +++ b/modules/angular2/src/forms/directives/ng_form.ts @@ -26,7 +26,7 @@ const formDirectiveBinding = * ``` * @Component({selector: "signup-comp"}) * @View({ - * directives: [formDirectives], + * directives: [FORM_DIRECTIVES], * template: ` * *
diff --git a/modules/angular2/src/forms/directives/ng_form_control.ts b/modules/angular2/src/forms/directives/ng_form_control.ts index e53ff0eba416a..669d7fc920895 100644 --- a/modules/angular2/src/forms/directives/ng_form_control.ts +++ b/modules/angular2/src/forms/directives/ng_form_control.ts @@ -27,7 +27,7 @@ const formControlBinding = * ``` * @Component({selector: "login-comp"}) * @View({ - * directives: [formDirectives], + * directives: [FORM_DIRECTIVES], * template: "" * }) * class LoginComp { @@ -45,7 +45,7 @@ const formControlBinding = * ``` * @Component({selector: "login-comp"}) * @View({ - * directives: [formDirectives], + * directives: [FORM_DIRECTIVES], * template: "" * }) * class LoginComp { diff --git a/modules/angular2/src/forms/directives/ng_form_model.ts b/modules/angular2/src/forms/directives/ng_form_model.ts index b7488825dbca1..46f6981fdd699 100644 --- a/modules/angular2/src/forms/directives/ng_form_model.ts +++ b/modules/angular2/src/forms/directives/ng_form_model.ts @@ -26,7 +26,7 @@ const formDirectiveBinding = * ``` * @Component({selector: "login-comp"}) * @View({ - * directives: [formDirectives], + * directives: [FORM_DIRECTIVES], * template: "" + * "Login " + * "Password " + @@ -55,7 +55,7 @@ const formDirectiveBinding = * ``` * @Component({selector: "login-comp"}) * @View({ - * directives: [formDirectives], + * directives: [FORM_DIRECTIVES], * template: "" + * "Login " + * "Password " + diff --git a/modules/angular2/src/forms/directives/ng_model.ts b/modules/angular2/src/forms/directives/ng_model.ts index 5e7b3a786f478..dbc0f908ee6f0 100644 --- a/modules/angular2/src/forms/directives/ng_model.ts +++ b/modules/angular2/src/forms/directives/ng_model.ts @@ -19,7 +19,7 @@ const formControlBinding = CONST_EXPR(new Binding(NgControl, {toAlias: forwardRe * ``` * @Component({selector: "search-comp"}) * @View({ - * directives: [formDirectives], + * directives: [FORM_DIRECTIVES], * template: ` * `}) diff --git a/modules/angular2/src/forms/form_builder.ts b/modules/angular2/src/forms/form_builder.ts index 93b2e08c92721..5754107b7a79b 100644 --- a/modules/angular2/src/forms/form_builder.ts +++ b/modules/angular2/src/forms/form_builder.ts @@ -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'; * * `, * directives: [ - * formDirectives + * FORM_DIRECTIVES * ] * }) * class LoginComp { diff --git a/modules/angular2/src/render/dom/compiler/compiler.ts b/modules/angular2/src/render/dom/compiler/compiler.ts index 5ba058951a5c9..b12c7c8216ad3 100644 --- a/modules/angular2/src/render/dom/compiler/compiler.ts +++ b/modules/angular2/src/render/dom/compiler/compiler.ts @@ -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); } diff --git a/modules/angular2/src/render/dom/dom_renderer.ts b/modules/angular2/src/render/dom/dom_renderer.ts index ccc4b937a89a1..e91206ecbf954 100644 --- a/modules/angular2/src/render/dom/dom_renderer.ts +++ b/modules/angular2/src/render/dom/dom_renderer.ts @@ -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(); diff --git a/modules/angular2/src/render/dom/dom_tokens.ts b/modules/angular2/src/render/dom/dom_tokens.ts index 2e1043d0d375f..8d8d1c0313151 100644 --- a/modules/angular2/src/render/dom/dom_tokens.ts +++ b/modules/angular2/src/render/dom/dom_tokens.ts @@ -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 { diff --git a/modules/angular2/src/render/dom/template_cloner.ts b/modules/angular2/src/render/dom/template_cloner.ts index da5bbe05d5228..f608240759fd2 100644 --- a/modules/angular2/src/render/dom/template_cloner.ts +++ b/modules/angular2/src/render/dom/template_cloner.ts @@ -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; } diff --git a/modules/angular2/src/render/dom/view/shared_styles_host.ts b/modules/angular2/src/render/dom/view/shared_styles_host.ts index 3fe44c4c921ef..fc6b6572bd969 100644 --- a/modules/angular2/src/render/dom/view/shared_styles_host.ts +++ b/modules/angular2/src/render/dom/view/shared_styles_host.ts @@ -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 = new Set(); - constructor(@Inject(DOCUMENT_TOKEN) doc: any) { + constructor(@Inject(DOCUMENT) doc: any) { super(); this._hostNodes.add(doc.head); } diff --git a/modules/angular2/src/router/location.ts b/modules/angular2/src/router/location.ts index 0757dd43a15c2..9432b88149924 100644 --- a/modules/angular2/src/router/location.ts +++ b/modules/angular2/src/router/location.ts @@ -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)) { diff --git a/modules/angular2/src/router/router_outlet.ts b/modules/angular2/src/router/router_outlet.ts index 39c707f495ea2..0ec1ac6e73dae 100644 --- a/modules/angular2/src/router/router_outlet.ts +++ b/modules/angular2/src/router/router_outlet.ts @@ -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'; diff --git a/modules/angular2/src/test_lib/test_component_builder.ts b/modules/angular2/src/test_lib/test_component_builder.ts index bac1d582b91c9..8d42e31d891f5 100644 --- a/modules/angular2/src/test_lib/test_component_builder.ts +++ b/modules/angular2/src/test_lib/test_component_builder.ts @@ -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(`
`); - 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]'); diff --git a/modules/angular2/src/test_lib/test_injector.ts b/modules/angular2/src/test_lib/test_injector.ts index 4c7dacfa58e49..f66db83694aaf 100644 --- a/modules/angular2/src/test_lib/test_injector.ts +++ b/modules/angular2/src/test_lib/test_injector.ts @@ -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()), diff --git a/modules/angular2/src/web-workers/ui/di_bindings.ts b/modules/angular2/src/web-workers/ui/di_bindings.ts index cf9ac9060d7d7..985e1ec40266d 100644 --- a/modules/angular2/src/web-workers/ui/di_bindings.ts +++ b/modules/angular2/src/web-workers/ui/di_bindings.ts @@ -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> { } return [ - bind(DOCUMENT_TOKEN) + bind(DOCUMENT) .toValue(DOM.defaultDoc()), bind(EventManager) .toFactory( @@ -94,7 +94,7 @@ function _injectorBindings(): List> { 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, diff --git a/modules/angular2/src/web-workers/worker/application_common.ts b/modules/angular2/src/web-workers/worker/application_common.ts index 731030f133cc4..fe4c7cd57dd00 100644 --- a/modules/angular2/src/web-workers/worker/application_common.ts +++ b/modules/angular2/src/web-workers/worker/application_common.ts @@ -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; } diff --git a/modules/angular2/test/core/application_spec.ts b/modules/angular2/test/core/application_spec.ts index dea7d32a118bb..1ea034951aaf5 100644 --- a/modules/angular2/test/core/application_spec.ts +++ b/modules/angular2/test/core/application_spec.ts @@ -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', diff --git a/modules/angular2/test/core/compiler/dynamic_component_loader_spec.ts b/modules/angular2/test/core/compiler/dynamic_component_loader_spec.ts index 00e2a7081f061..838b8b551aa62 100644 --- a/modules/angular2/test/core/compiler/dynamic_component_loader_spec.ts +++ b/modules/angular2/test/core/compiler/dynamic_component_loader_spec.ts @@ -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(''); DOM.appendChild(doc.body, rootEl); diff --git a/modules/angular2/test/core/compiler/projection_integration_spec.ts b/modules/angular2/test/core/compiler/projection_integration_spec.ts index 922ee3b79b9eb..7546e7eb95f79 100644 --- a/modules/angular2/test/core/compiler/projection_integration_spec.ts +++ b/modules/angular2/test/core/compiler/projection_integration_spec.ts @@ -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(); }); diff --git a/modules/angular2/test/forms/integration_spec.ts b/modules/angular2/test/forms/integration_spec.ts index ddf1b5f9cf5e0..f31815378b1a1 100644 --- a/modules/angular2/test/forms/integration_spec.ts +++ b/modules/angular2/test/forms/integration_spec.ts @@ -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; diff --git a/modules/angular2/test/render/dom/dom_testbed.ts b/modules/angular2/test/render/dom/dom_testbed.ts index 26c1d7594c85f..7d6a36979f924 100644 --- a/modules/angular2/test/render/dom/dom_testbed.ts +++ b/modules/angular2/test/render/dom/dom_testbed.ts @@ -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('
'); diff --git a/modules/angular2/test/router/location_spec.ts b/modules/angular2/test/router/location_spec.ts index 260a5e7d2ac23..83e27466e4193 100644 --- a/modules/angular2/test/router/location_spec.ts +++ b/modules/angular2/test/router/location_spec.ts @@ -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'); }); diff --git a/modules/angular2/test/router/route_config_spec.ts b/modules/angular2/test/router/route_config_spec.ts index adbd9c088df69..91b8936360e9e 100644 --- a/modules/angular2/test/router/route_config_spec.ts +++ b/modules/angular2/test/router/route_config_spec.ts @@ -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) ]; }); diff --git a/modules/angular2/test/router/router_integration_spec.ts b/modules/angular2/test/router/router_integration_spec.ts index 7b4402de40b6d..c073b3c607102 100644 --- a/modules/angular2/test/router/router_integration_spec.ts +++ b/modules/angular2/test/router/router_integration_spec.ts @@ -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) => { diff --git a/modules/examples/src/http/index.ts b/modules/examples/src/http/index.ts index 155b380c22d24..e5cfae78b5f87 100644 --- a/modules/examples/src/http/index.ts +++ b/modules/examples/src/http/index.ts @@ -1,9 +1,9 @@ /// 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]); } diff --git a/modules/examples/src/http/index_dynamic.ts b/modules/examples/src/http/index_dynamic.ts index 13d232901ed91..96e5beab65440 100644 --- a/modules/examples/src/http/index_dynamic.ts +++ b/modules/examples/src/http/index_dynamic.ts @@ -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]); } diff --git a/modules/examples/src/jsonp/index.ts b/modules/examples/src/jsonp/index.ts index f1d9cd656c55a..663303fd5da4c 100644 --- a/modules/examples/src/jsonp/index.ts +++ b/modules/examples/src/jsonp/index.ts @@ -1,9 +1,9 @@ /// 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]); } diff --git a/modules/examples/src/jsonp/index_dynamic.ts b/modules/examples/src/jsonp/index_dynamic.ts index 3f400290326d4..787959501ed3a 100644 --- a/modules/examples/src/jsonp/index_dynamic.ts +++ b/modules/examples/src/jsonp/index_dynamic.ts @@ -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]); } diff --git a/modules/examples/src/model_driven_forms/index.ts b/modules/examples/src/model_driven_forms/index.ts index cbd60c36c2ca5..2c122693db58c 100644 --- a/modules/examples/src/model_driven_forms/index.ts +++ b/modules/examples/src/model_driven_forms/index.ts @@ -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 { `, - directives: [formDirectives, NgFor, ShowError] + directives: [FORM_DIRECTIVES, NgFor, ShowError] }) class ModelDrivenForms { form; diff --git a/modules/examples/src/order_management/index.ts b/modules/examples/src/order_management/index.ts index 5145cc3095827..498ed22ef37cf 100644 --- a/modules/examples/src/order_management/index.ts +++ b/modules/examples/src/order_management/index.ts @@ -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 {
`, - directives: [formDirectives, NgFor] + directives: [FORM_DIRECTIVES, NgFor] }) class OrderListComponent { orders: Order[]; @@ -143,7 +143,7 @@ class OrderListComponent {
`, - directives: [formDirectives] + directives: [FORM_DIRECTIVES] }) class OrderItemComponent { item: OrderItem; @@ -180,7 +180,7 @@ class OrderItemComponent { `, - directives: [formDirectives, OrderItemComponent, NgFor, NgIf] + directives: [FORM_DIRECTIVES, OrderItemComponent, NgFor, NgIf] }) class OrderDetailsComponent { constructor(private service: DataService) {} diff --git a/modules/examples/src/person_management/index.ts b/modules/examples/src/person_management/index.ts index b85a9474ac445..7285132e0500b 100644 --- a/modules/examples/src/person_management/index.ts +++ b/modules/examples/src/person_management/index.ts @@ -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 { `, - directives: [formDirectives] + directives: [FORM_DIRECTIVES] }) class FullNameComponent { constructor(private service: DataService) {} @@ -161,7 +161,7 @@ class FullNameComponent { `, - directives: [formDirectives, NgIf] + directives: [FORM_DIRECTIVES, NgIf] }) class PersonsDetailComponent { constructor(private service: DataService) {} @@ -182,7 +182,7 @@ class PersonsDetailComponent { `, - directives: [formDirectives, PersonsDetailComponent, NgFor] + directives: [FORM_DIRECTIVES, PersonsDetailComponent, NgFor] }) class PersonsComponent { persons: Person[]; diff --git a/modules/examples/src/routing/index.ts b/modules/examples/src/routing/index.ts index 5f33fb1e059c2..6e0d1960747dd 100644 --- a/modules/examples/src/routing/index.ts +++ b/modules/examples/src/routing/index.ts @@ -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)]); } diff --git a/modules/examples/src/template_driven_forms/index.ts b/modules/examples/src/template_driven_forms/index.ts index f174f0ad01d29..18d384018df77 100644 --- a/modules/examples/src/template_driven_forms/index.ts +++ b/modules/examples/src/template_driven_forms/index.ts @@ -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 { `, - directives: [formDirectives, NgFor, CreditCardValidator, ShowError] + directives: [FORM_DIRECTIVES, NgFor, CreditCardValidator, ShowError] }) class TemplateDrivenForms { model = new CheckoutModel(); diff --git a/modules/examples/src/web_workers/images/index_common.ts b/modules/examples/src/web_workers/images/index_common.ts index 8f47ae0e14e64..97cb02d5510f2 100644 --- a/modules/examples/src/web_workers/images/index_common.ts +++ b/modules/examples/src/web_workers/images/index_common.ts @@ -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; diff --git a/modules/examples/src/web_workers/todo/index_common.ts b/modules/examples/src/web_workers/todo/index_common.ts index 4f515f407c950..29571ad299dc5 100644 --- a/modules/examples/src/web_workers/todo/index_common.ts +++ b/modules/examples/src/web_workers/todo/index_common.ts @@ -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; diff --git a/modules/http/http.ts b/modules/http/http.ts index 84509e77c7dbf..6019609678ff9 100644 --- a/modules/http/http.ts +++ b/modules/http/http.ts @@ -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 = [ +export const HTTP_BINDINGS: List = [ bind(ConnectionBackend) .toClass(XHRBackend), BrowserXhr, @@ -70,7 +70,7 @@ export var httpInjectables: List = [ Http ]; -export var jsonpInjectables: List = [ +export const JSONP_BINDINGS: List = [ bind(ConnectionBackend) .toClass(JSONPBackend), BrowserJsonp, diff --git a/modules/http/index.ts b/modules/http/index.ts index 03c5893c4e122..14dfa1231254c 100644 --- a/modules/http/index.ts +++ b/modules/http/index.ts @@ -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); diff --git a/modules/http/src/backends/xhr_backend.ts b/modules/http/src/backends/xhr_backend.ts index aab172d3d1765..c25f1fe445e60 100644 --- a/modules/http/src/backends/xhr_backend.ts +++ b/modules/http/src/backends/xhr_backend.ts @@ -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])] diff --git a/modules/http/src/http.ts b/modules/http/src/http.ts index 0bdfd24881517..a5ed37cf54837 100644 --- a/modules/http/src/http.ts +++ b/modules/http/src/http.ts @@ -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) {