diff --git a/modules/angular2/angular2.ts b/modules/angular2/angular2.ts index 7cf9d64925..ecac884c6a 100644 --- a/modules/angular2/angular2.ts +++ b/modules/angular2/angular2.ts @@ -7,31 +7,9 @@ export {commonBootstrap as bootstrap} from 'angular2/src/core/application_common // angular2_exports.ts. Re-exporting from angular2_exports.ts causes systemjs // to resolve imports very very very slowly. See also a similar notice in // bootstrap.ts -export * from 'angular2/annotations'; -export * from 'angular2/core'; - -export { - DehydratedException, - ExpressionChangedAfterItHasBeenChecked, - ChangeDetectionError, - - ON_PUSH, - DEFAULT, - - ChangeDetectorRef, - - Pipes, - WrappedValue, - Pipe, - PipeFactory, - NullPipe, - NullPipeFactory, - defaultPipes, - BasePipe, - - Locals -} from './change_detection'; - +export * from './annotations'; +export * from './core'; +export * from './change_detection'; export * from './di'; export * from './forms'; export * from './directives'; diff --git a/modules/angular2/angular2_exports.ts b/modules/angular2/angular2_exports.ts index bb7318c005..fdc186a947 100644 --- a/modules/angular2/angular2_exports.ts +++ b/modules/angular2/angular2_exports.ts @@ -1,28 +1,6 @@ -export * from 'angular2/annotations'; -export * from 'angular2/core'; - -export { - DehydratedException, - ExpressionChangedAfterItHasBeenChecked, - ChangeDetectionError, - - ON_PUSH, - DEFAULT, - - ChangeDetectorRef, - - Pipes, - WrappedValue, - Pipe, - PipeFactory, - NullPipe, - NullPipeFactory, - defaultPipes, - BasePipe, - - Locals -} from './change_detection'; - +export * from './annotations'; +export * from './core'; +export * from './change_detection'; export * from './di'; export * from './forms'; export * from './directives'; diff --git a/modules/angular2/change_detection.ts b/modules/angular2/change_detection.ts index 7631ccaea7..d79b7c8dda 100644 --- a/modules/angular2/change_detection.ts +++ b/modules/angular2/change_detection.ts @@ -4,52 +4,33 @@ * Change detection enables data binding in Angular. */ -export { - ASTWithSource, - AST, - AstTransformer, - AccessMember, - LiteralArray, - ImplicitReceiver -} from './src/change_detection/parser/ast'; - -export {Lexer} from './src/change_detection/parser/lexer'; -export {Parser} from './src/change_detection/parser/parser'; -export {Locals} from './src/change_detection/parser/locals'; - -export { - DehydratedException, - ExpressionChangedAfterItHasBeenChecked, - ChangeDetectionError -} from './src/change_detection/exceptions'; -export { - ProtoChangeDetector, - ChangeDetector, - ChangeDispatcher, - ChangeDetection, - ChangeDetectorDefinition -} from './src/change_detection/interfaces'; export { CHECK_ONCE, CHECK_ALWAYS, DETACHED, CHECKED, ON_PUSH, - DEFAULT -} from './src/change_detection/constants'; -export {DynamicProtoChangeDetector} from './src/change_detection/proto_change_detector'; -export {BindingRecord} from './src/change_detection/binding_record'; -export {DirectiveIndex, DirectiveRecord} from './src/change_detection/directive_record'; -export {DynamicChangeDetector} from './src/change_detection/dynamic_change_detector'; -export {ChangeDetectorRef} from './src/change_detection/change_detector_ref'; -export {Pipes} from './src/change_detection/pipes/pipes'; -export {uninitialized} from './src/change_detection/change_detection_util'; -export {WrappedValue, Pipe, PipeFactory, BasePipe} from './src/change_detection/pipes/pipe'; -export {NullPipe, NullPipeFactory} from './src/change_detection/pipes/null_pipe'; -export { - defaultPipes, + DEFAULT, + + ExpressionChangedAfterItHasBeenCheckedException, + ChangeDetectionError, + + ChangeDetectorRef, + + WrappedValue, + Pipe, + Pipes, + PipeFactory, + BasePipe, + NullPipe, + NullPipeFactory, + + ChangeDetector, + ChangeDispatcher, + ChangeDetection, + ChangeDetectorDefinition, DynamicChangeDetection, JitChangeDetection, PreGeneratedChangeDetection, preGeneratedProtoDetectors -} from './src/change_detection/change_detection'; +} from 'angular2/src/change_detection/change_detection'; diff --git a/modules/angular2/core.ts b/modules/angular2/core.ts index b6dd109055..2d1b1bee4c 100644 --- a/modules/angular2/core.ts +++ b/modules/angular2/core.ts @@ -17,16 +17,14 @@ export {Compiler} from 'angular2/src/core/compiler/compiler'; export {AppViewManager} from 'angular2/src/core/compiler/view_manager'; export {IQueryList} from 'angular2/src/core/compiler/interface_query'; export {QueryList} from 'angular2/src/core/compiler/query_list'; +export {DynamicComponentLoader} from 'angular2/src/core/compiler/dynamic_component_loader'; + export {ElementRef} from 'angular2/src/core/compiler/element_ref'; export {TemplateRef} from 'angular2/src/core/compiler/template_ref'; export {RenderElementRef} from 'angular2/src/render/api'; -export {ViewRef, ProtoViewRef} from 'angular2/src/core/compiler/view_ref'; +export {ViewRef, HostViewRef, ProtoViewRef} from 'angular2/src/core/compiler/view_ref'; export {ViewContainerRef} from 'angular2/src/core/compiler/view_container_ref'; - -export { - DynamicComponentLoader, - ComponentRef -} from 'angular2/src/core/compiler/dynamic_component_loader'; +export {ComponentRef} from 'angular2/src/core/compiler/dynamic_component_loader'; export {NgZone} from 'angular2/src/core/zone/ng_zone'; export {Observable, EventEmitter} from 'angular2/src/facade/async'; diff --git a/modules/angular2/src/change_detection/change_detection.ts b/modules/angular2/src/change_detection/change_detection.ts index c7b936c3ba..98ae24e12d 100644 --- a/modules/angular2/src/change_detection/change_detection.ts +++ b/modules/angular2/src/change_detection/change_detection.ts @@ -19,6 +19,43 @@ import {Inject, Injectable, OpaqueToken, Optional} from 'angular2/di'; import {List, StringMap, StringMapWrapper} from 'angular2/src/facade/collection'; import {CONST, CONST_EXPR, isPresent, BaseException} from 'angular2/src/facade/lang'; +export { + ASTWithSource, + AST, + AstTransformer, + AccessMember, + LiteralArray, + ImplicitReceiver +} from './parser/ast'; + +export {Lexer} from './parser/lexer'; +export {Parser} from './parser/parser'; +export {Locals} from './parser/locals'; + +export { + DehydratedException, + ExpressionChangedAfterItHasBeenCheckedException, + ChangeDetectionError +} from './exceptions'; +export { + ProtoChangeDetector, + ChangeDetector, + ChangeDispatcher, + ChangeDetection, + ChangeDetectorDefinition +} from './interfaces'; +export {CHECK_ONCE, CHECK_ALWAYS, DETACHED, CHECKED, ON_PUSH, DEFAULT} from './constants'; +export {DynamicProtoChangeDetector} from './proto_change_detector'; +export {BindingRecord} from './binding_record'; +export {DirectiveIndex, DirectiveRecord} from './directive_record'; +export {DynamicChangeDetector} from './dynamic_change_detector'; +export {ChangeDetectorRef} from './change_detector_ref'; +export {Pipes} from './pipes/pipes'; +export {uninitialized} from './change_detection_util'; +export {WrappedValue, Pipe, PipeFactory, BasePipe} from './pipes/pipe'; +export {NullPipe, NullPipeFactory} from './pipes/null_pipe'; + + /** * Structural diffing for `Object`s and `Map`s. */ diff --git a/modules/angular2/src/change_detection/change_detection_util.ts b/modules/angular2/src/change_detection/change_detection_util.ts index 4077f1c55a..84d100c447 100644 --- a/modules/angular2/src/change_detection/change_detection_util.ts +++ b/modules/angular2/src/change_detection/change_detection_util.ts @@ -1,7 +1,7 @@ import {isPresent, isBlank, BaseException, Type} from 'angular2/src/facade/lang'; import {List, ListWrapper, MapWrapper, StringMapWrapper} from 'angular2/src/facade/collection'; import {ProtoRecord} from './proto_record'; -import {DehydratedException, ExpressionChangedAfterItHasBeenChecked} from './exceptions'; +import {DehydratedException, ExpressionChangedAfterItHasBeenCheckedException} from './exceptions'; import {WrappedValue} from './pipes/pipe'; import {CHECK_ALWAYS, CHECK_ONCE, CHECKED, DETACHED, ON_PUSH} from './constants'; @@ -129,7 +129,7 @@ export class ChangeDetectionUtil { } static throwOnChange(proto: ProtoRecord, change) { - throw new ExpressionChangedAfterItHasBeenChecked(proto, change, null); + throw new ExpressionChangedAfterItHasBeenCheckedException(proto, change, null); } static throwDehydrated() { throw new DehydratedException(); } diff --git a/modules/angular2/src/change_detection/change_detector_ref.ts b/modules/angular2/src/change_detection/change_detector_ref.ts index 5b7a9cd5e4..781510954c 100644 --- a/modules/angular2/src/change_detection/change_detector_ref.ts +++ b/modules/angular2/src/change_detection/change_detector_ref.ts @@ -5,10 +5,12 @@ import {CHECK_ONCE, DETACHED, CHECK_ALWAYS} from './constants'; * Controls change detection. * * {@link ChangeDetectorRef} allows requesting checks for detectors that rely on observables. It - *also allows detaching and - * attaching change detector subtrees. + * also allows detaching and attaching change detector subtrees. */ export class ChangeDetectorRef { + /** + * @private + */ constructor(private _cd: ChangeDetector) {} /** diff --git a/modules/angular2/src/change_detection/exceptions.ts b/modules/angular2/src/change_detection/exceptions.ts index 4bee36c0ce..520da217ed 100644 --- a/modules/angular2/src/change_detection/exceptions.ts +++ b/modules/angular2/src/change_detection/exceptions.ts @@ -1,14 +1,31 @@ import {ProtoRecord} from './proto_record'; import {BaseException} from "angular2/src/facade/lang"; -export class ExpressionChangedAfterItHasBeenChecked extends BaseException { +/** + * An error thrown if application changes model breaking the top-down data flow. + * + * Angular expects that the data flows from top (root) component to child (leaf) components. + * This is known as directed acyclic graph. This allows Angular to only execute change detection + * once and prevents loops in change detection data flow. + * + * This exception is only thrown in dev mode. + */ +export class ExpressionChangedAfterItHasBeenCheckedException extends BaseException { constructor(proto: ProtoRecord, change: any, context: any) { super(`Expression '${proto.expressionAsString}' has changed after it was checked. ` + `Previous value: '${change.previousValue}'. Current value: '${change.currentValue}'`); } } +/** + * Thrown when an expression evaluation raises an exception. + * + * This error wraps the original exception, this is done to attach expression location information. + */ export class ChangeDetectionError extends BaseException { + /** + * Location of the expression. + */ location: string; constructor(proto: ProtoRecord, originalException: any, originalStack: any, context: any) { @@ -18,6 +35,11 @@ export class ChangeDetectionError extends BaseException { } } +/** + * Thrown when change detector executes on dehydrated view. + * + * This is angular internal error. + */ export class DehydratedException extends BaseException { constructor() { super('Attempt to detect changes on a dehydrated detector.'); } } diff --git a/modules/angular2/src/change_detection/pipes/pipe.ts b/modules/angular2/src/change_detection/pipes/pipe.ts index e73378b4d7..e4f747343d 100644 --- a/modules/angular2/src/change_detection/pipes/pipe.ts +++ b/modules/angular2/src/change_detection/pipes/pipe.ts @@ -3,7 +3,7 @@ import {ChangeDetectorRef} from '../change_detector_ref'; /** * Indicates that the result of a {@link Pipe} transformation has changed even though the reference - *has not changed. + * has not changed. * * The wrapped value will be unwrapped by change detection, and the unwrapped value will be stored. */ @@ -28,9 +28,7 @@ var _wrappedValues = [ var _wrappedIndex = 0; /** - * An interface for extending the list of pipes known to Angular. - * - * If you are writing a custom {@link Pipe}, you must extend this interface. + * An interface which all pipes must implement. * * #Example * @@ -49,18 +47,23 @@ var _wrappedIndex = 0; * ``` */ export interface Pipe { + /** + * Query if a pipe supports a particular object instance. + */ supports(obj): boolean; + onDestroy(): void; + transform(value: any, args: List): any; } /** - * Provides default implementation of supports and onDestroy. + * Provides default implementation of `supports` and `onDestroy` method. * * #Example * * ``` - * class DoublePipe extends BasePipe {* + * class DoublePipe extends BasePipe { * transform(value) { * return `${value}${value}`; * } @@ -74,6 +77,9 @@ export class BasePipe implements Pipe { transform(value: any, args: List): any { return _abstract(); } } +/** + * + */ export interface PipeFactory { supports(obs): boolean; create(cdRef: ChangeDetectorRef): Pipe; diff --git a/modules/angular2/src/change_detection/pipes/pipes.ts b/modules/angular2/src/change_detection/pipes/pipes.ts index 152321f3ae..23b90e8a18 100644 --- a/modules/angular2/src/change_detection/pipes/pipes.ts +++ b/modules/angular2/src/change_detection/pipes/pipes.ts @@ -26,6 +26,8 @@ export class Pipes { * ``` */ config: StringMap; + + constructor(config: StringMap) { this.config = config; } get(type: string, obj: any, cdRef?: ChangeDetectorRef, existingPipe?: Pipe): Pipe { diff --git a/modules/angular2/src/core/compiler/dynamic_component_loader.ts b/modules/angular2/src/core/compiler/dynamic_component_loader.ts index b464becab1..726912e1ad 100644 --- a/modules/angular2/src/core/compiler/dynamic_component_loader.ts +++ b/modules/angular2/src/core/compiler/dynamic_component_loader.ts @@ -4,12 +4,41 @@ import {Type, BaseException, stringify, isPresent} from 'angular2/src/facade/lan import {Promise} from 'angular2/src/facade/async'; import {AppViewManager} from 'angular2/src/core/compiler/view_manager'; import {ElementRef} from './element_ref'; -import {ViewRef} from './view_ref'; +import {ViewRef, HostViewRef} from './view_ref'; +/** + * Angular's reference to a component instance. + * + * `ComponentRef` represents a component instance lifecycle and meta information. + */ export class ComponentRef { - constructor(public location: ElementRef, public instance: any, public dispose: Function) {} + /** + * Location of the component host element. + */ + location: ElementRef; - get hostView(): ViewRef { return this.location.parentView; } + /** + * Instance of component. + */ + instance: any; + + /** + * @private + */ + constructor(location: ElementRef, instance: any, private _dispose: () => void) { + this.location = location; + this.instance = instance; + } + + /** + * Returns the host {@link ViewRef}. + */ + get hostView(): HostViewRef { return this.location.parentView; } + + /** + * Dispose of the component instance. + */ + dispose() { this._dispose(); } } /** @@ -24,7 +53,56 @@ export class DynamicComponentLoader { * Loads a root component that is placed at the first element that matches the component's * selector. * + * - `typeOrBinding` {@link Type} \ {@link Binding} - representing the component to load. + * - `overrideSelector` (optional) selector to load the component at (or use + * `@Component.selector`) The selector can be anywhere (i.e. outside the current component.) + * - `injector` {@link Injector} - optional injector to use for the component. + * * The loaded component receives injection normally as a hosted view. + * + * + * ## Example + * + * ``` + * @ng.Component({ + * selector: 'child-component' + * }) + * @ng.View({ + * template: 'Child' + * }) + * class ChildComponent { + * } + * + * + * + * @ng.Component({ + * selector: 'my-app' + * }) + * @ng.View({ + * template: ` + * Parent () + * ` + * }) + * class MyApp { + * constructor(dynamicComponentLoader: ng.DynamicComponentLoader, injector: ng.Injector) { + * dynamicComponentLoader.loadAsRoot(ChildComponent, '#child', injector); + * } + * } + * + * ng.bootstrap(MyApp); + * ``` + * + * Resulting DOM: + * + * ``` + * + * Parent ( + * + * Child + * + * ) + * + * ``` */ loadAsRoot(typeOrBinding: Type | Binding, overrideSelector: string, injector: Injector): Promise { @@ -41,10 +119,51 @@ export class DynamicComponentLoader { } /** - * Loads a component into the component view of the provided ElementRef - * next to the element with the given name - * The loaded component receives - * injection normally as a hosted view. + * Loads a component into the component view of the provided ElementRef next to the element + * with the given name. + * + * The loaded component receives injection normally as a hosted view. + * + * ## Example + * + * ``` + * @ng.Component({ + * selector: 'child-component' + * }) + * @ng.View({ + * template: 'Child' + * }) + * class ChildComponent { + * } + * + * + * @ng.Component({ + * selector: 'my-app' + * }) + * @ng.View({ + * template: ` + * Parent (
) + * ` + * }) + * class MyApp { + * constructor(dynamicComponentLoader: ng.DynamicComponentLoader, elementRef: ng.ElementRef) { + * dynamicComponentLoader.loadIntoLocation(ChildComponent, elementRef, 'child'); + * } + * } + * + * ng.bootstrap(MyApp); + * ``` + * + * Resulting DOM: + * + * ``` + * + * Parent ( + *
+ * Child + * ) + *
+ * ``` */ loadIntoLocation(typeOrBinding: Type | Binding, hostLocation: ElementRef, anchorName: string, bindings: ResolvedBinding[] = null): Promise { @@ -54,8 +173,45 @@ export class DynamicComponentLoader { } /** - * Loads a component next to the provided ElementRef. The loaded component receives - * injection normally as a hosted view. + * Loads a component next to the provided ElementRef. + * + * The loaded component receives injection normally as a hosted view. + * + * + * ## Example + * + * ``` + * @ng.Component({ + * selector: 'child-component' + * }) + * @ng.View({ + * template: 'Child' + * }) + * class ChildComponent { + * } + * + * + * @ng.Component({ + * selector: 'my-app' + * }) + * @ng.View({ + * template: `Parent` + * }) + * class MyApp { + * constructor(dynamicComponentLoader: ng.DynamicComponentLoader, elementRef: ng.ElementRef) { + * dynamicComponentLoader.loadIntoLocation(ChildComponent, elementRef, 'child'); + * } + * } + * + * ng.bootstrap(MyApp); + * ``` + * + * Resulting DOM: + * + * ``` + * Parent + * Child + * ``` */ loadNextToLocation(typeOrBinding: Type | Binding, location: ElementRef, bindings: ResolvedBinding[] = null): Promise { @@ -68,7 +224,7 @@ export class DynamicComponentLoader { var component = this._viewManager.getComponent(newLocation); var dispose = () => { - var index = viewContainer.indexOf(hostViewRef); + var index = viewContainer.indexOf(hostViewRef); if (index !== -1) { viewContainer.remove(index); } diff --git a/modules/angular2/src/core/compiler/element_binder.ts b/modules/angular2/src/core/compiler/element_binder.ts index adca11aa3d..beeee6369b 100644 --- a/modules/angular2/src/core/compiler/element_binder.ts +++ b/modules/angular2/src/core/compiler/element_binder.ts @@ -1,4 +1,4 @@ -import {AST} from 'angular2/change_detection'; +import {AST} from 'angular2/src/change_detection/change_detection'; import {isBlank, isPresent, BaseException} from 'angular2/src/facade/lang'; import * as eiModule from './element_injector'; import {DirectiveBinding} from './element_injector'; diff --git a/modules/angular2/src/core/compiler/element_injector.ts b/modules/angular2/src/core/compiler/element_injector.ts index bf9657da26..9d61a4a60c 100644 --- a/modules/angular2/src/core/compiler/element_injector.ts +++ b/modules/angular2/src/core/compiler/element_injector.ts @@ -43,7 +43,11 @@ import {ElementRef} from './element_ref'; import {TemplateRef} from './template_ref'; import {Directive, Component, LifecycleEvent} from 'angular2/src/core/annotations_impl/annotations'; import {hasLifecycleHook} from './directive_lifecycle_reflector'; -import {ChangeDetector, ChangeDetectorRef, Pipes} from 'angular2/change_detection'; +import { + ChangeDetector, + ChangeDetectorRef, + Pipes +} from 'angular2/src/change_detection/change_detection'; import {QueryList} from './query_list'; import {reflector} from 'angular2/src/reflection/reflection'; import {DirectiveMetadata} from 'angular2/src/render/api'; diff --git a/modules/angular2/src/core/compiler/proto_view_factory.ts b/modules/angular2/src/core/compiler/proto_view_factory.ts index fbecda65e2..0c8f39856a 100644 --- a/modules/angular2/src/core/compiler/proto_view_factory.ts +++ b/modules/angular2/src/core/compiler/proto_view_factory.ts @@ -13,7 +13,7 @@ import { DEFAULT, ChangeDetectorDefinition, ASTWithSource -} from 'angular2/change_detection'; +} from 'angular2/src/change_detection/change_detection'; import * as renderApi from 'angular2/src/render/api'; import {AppProtoView} from './view'; diff --git a/modules/angular2/src/core/compiler/view.ts b/modules/angular2/src/core/compiler/view.ts index 454366976e..043f42d2cf 100644 --- a/modules/angular2/src/core/compiler/view.ts +++ b/modules/angular2/src/core/compiler/view.ts @@ -16,7 +16,7 @@ import { DirectiveRecord, DirectiveIndex, ChangeDetectorRef -} from 'angular2/change_detection'; +} from 'angular2/src/change_detection/change_detection'; import { ProtoElementInjector, diff --git a/modules/angular2/src/core/compiler/view_container_ref.ts b/modules/angular2/src/core/compiler/view_container_ref.ts index 6f32de4d0e..6212a1c349 100644 --- a/modules/angular2/src/core/compiler/view_container_ref.ts +++ b/modules/angular2/src/core/compiler/view_container_ref.ts @@ -7,9 +7,19 @@ import * as viewModule from './view'; import {ElementRef} from './element_ref'; import {TemplateRef} from './template_ref'; -import {ViewRef, ProtoViewRef, internalView} from './view_ref'; +import {ViewRef, HostViewRef, ProtoViewRef, internalView} from './view_ref'; +/** + * A location where {@link ViewRef}s can be attached. + * + * A `ViewContainerRef` represents a location in a {@link ViewRef} where other child + * {@link ViewRef}s can be inserted. Adding and removing views is the only way of structurally + * changing the rendered DOM of the application. + */ export class ViewContainerRef { + /** + * @private + */ constructor(public viewManager: avmModule.AppViewManager, public element: ElementRef) {} private _getViews(): List { @@ -17,16 +27,39 @@ export class ViewContainerRef { return isPresent(vc) ? vc.views : []; } + /** + * Remove all {@link ViewRef}s at current location. + */ clear(): void { for (var i = this.length - 1; i >= 0; i--) { this.remove(i); } } + /** + * Return a {@link ViewRef} at specific index. + */ get(index: number): ViewRef { return this._getViews()[index].ref; } + /** + * Returns number of {@link ViewRef}s currently attached at this location. + */ get length(): number { return this._getViews().length; } + /** + * Create and insert a {@link ViewRef} into the view-container. + * + * - `protoViewRef` (optional) {@link ProtoViewRef} - The `ProtoView` to use for creating + * `View` to be inserted at this location. If `ViewContainer` is created at a location + * of inline template, then `protoViewRef` is the `ProtoView` of the template. + * - `atIndex` (optional) `number` - location of insertion point. (Or at the end if unspecified.) + * - `context` (optional) {@link ElementRef} - Context (for expression evaluation) from the + * {@link ElementRef} location. (Or current context if unspecified.) + * - `bindings` (optional) Array of {@link ResolvedBinding} - Used for configuring + * `ElementInjector`. + * + * Returns newly created {@link ViewRef}. + */ // TODO(rado): profile and decide whether bounds checks should be added // to the methods below. createEmbeddedView(templateRef: TemplateRef, atIndex: number = -1): ViewRef { @@ -35,21 +68,37 @@ export class ViewContainerRef { } createHostView(protoViewRef: ProtoViewRef = null, atIndex: number = -1, - dynamicallyCreatedBindings: ResolvedBinding[] = null): ViewRef { + dynamicallyCreatedBindings: ResolvedBinding[] = null): HostViewRef { if (atIndex == -1) atIndex = this.length; return this.viewManager.createHostViewInContainer(this.element, atIndex, protoViewRef, dynamicallyCreatedBindings); } + /** + * Insert a {@link ViewRef} at specefic index. + * + * The index is location at which the {@link ViewRef} should be attached. If omitted it is + * inserted at the end. + * + * Returns the inserted {@link ViewRef}. + */ insert(viewRef: ViewRef, atIndex: number = -1): ViewRef { if (atIndex == -1) atIndex = this.length; return this.viewManager.attachViewInContainer(this.element, atIndex, viewRef); } + /** + * Return the index of already inserted {@link ViewRef}. + */ indexOf(viewRef: ViewRef): number { return ListWrapper.indexOf(this._getViews(), internalView(viewRef)); } + /** + * Remove a {@link ViewRef} at specific index. + * + * If the index is omitted last {@link ViewRef} is removed. + */ remove(atIndex: number = -1): void { if (atIndex == -1) atIndex = this.length - 1; this.viewManager.destroyViewInContainer(this.element, atIndex); diff --git a/modules/angular2/src/core/compiler/view_manager.ts b/modules/angular2/src/core/compiler/view_manager.ts index aeea9d356a..9f6d856a0f 100644 --- a/modules/angular2/src/core/compiler/view_manager.ts +++ b/modules/angular2/src/core/compiler/view_manager.ts @@ -2,7 +2,7 @@ import {Injector, Binding, Injectable, ResolvedBinding} from 'angular2/di'; import {isPresent, isBlank, BaseException} from 'angular2/src/facade/lang'; import * as viewModule from './view'; import {ElementRef} from './element_ref'; -import {ProtoViewRef, ViewRef, internalView, internalProtoView} from './view_ref'; +import {ProtoViewRef, ViewRef, HostViewRef, internalView, internalProtoView} from './view_ref'; import {ViewContainerRef} from './view_container_ref'; import {TemplateRef} from './template_ref'; import { @@ -40,8 +40,8 @@ export class AppViewManager { /** * Return the first child element of the host element view. */ - getHostElement(hostViewRef: ViewRef): ElementRef { - var hostView = internalView(hostViewRef); + getHostElement(hostViewRef: HostViewRef): ElementRef { + var hostView = internalView(hostViewRef); if (hostView.proto.type !== ViewType.HOST) { throw new BaseException('This operation is only allowed on host views'); } @@ -138,7 +138,7 @@ export class AppViewManager { * ``` */ createRootHostView(hostProtoViewRef: ProtoViewRef, overrideSelector: string, - injector: Injector): ViewRef { + injector: Injector): HostViewRef { var hostProtoView: viewModule.AppProtoView = internalProtoView(hostProtoViewRef); var hostElementSelector = overrideSelector; if (isBlank(hostElementSelector)) { @@ -158,10 +158,10 @@ export class AppViewManager { /** * Remove the View created with {@link AppViewManager#createRootHostView}. */ - destroyRootHostView(hostViewRef: ViewRef) { + destroyRootHostView(hostViewRef: HostViewRef) { // Note: Don't put the hostView into the view pool // as it is depending on the element for which it was created. - var hostView = internalView(hostViewRef); + var hostView = internalView(hostViewRef); this._renderer.detachFragment(hostView.renderFragment); this._renderer.dehydrateView(hostView.render); this._viewDehydrateRecurse(hostView); @@ -189,7 +189,7 @@ export class AppViewManager { */ createHostViewInContainer(viewContainerLocation: ElementRef, atIndex: number, protoViewRef: ProtoViewRef, - imperativelyCreatedInjector: ResolvedBinding[]): ViewRef { + imperativelyCreatedInjector: ResolvedBinding[]): HostViewRef { var protoView = internalProtoView(protoViewRef); if (protoView.type !== ViewType.HOST) { throw new BaseException('This method can only be called with host ProtoViews!'); diff --git a/modules/angular2/src/core/compiler/view_manager_utils.ts b/modules/angular2/src/core/compiler/view_manager_utils.ts index 083b4e1baf..a88c3f0331 100644 --- a/modules/angular2/src/core/compiler/view_manager_utils.ts +++ b/modules/angular2/src/core/compiler/view_manager_utils.ts @@ -8,7 +8,7 @@ import * as avmModule from './view_manager'; import {ElementRef} from './element_ref'; import {TemplateRef} from './template_ref'; import {Renderer, RenderViewWithFragments} from 'angular2/src/render/api'; -import {Locals} from 'angular2/change_detection'; +import {Locals} from 'angular2/src/change_detection/change_detection'; import {RenderViewRef, RenderFragmentRef, ViewType} from 'angular2/src/render/api'; @Injectable() diff --git a/modules/angular2/src/core/compiler/view_ref.ts b/modules/angular2/src/core/compiler/view_ref.ts index ff784dcb40..aff280329f 100644 --- a/modules/angular2/src/core/compiler/view_ref.ts +++ b/modules/angular2/src/core/compiler/view_ref.ts @@ -12,6 +12,8 @@ export function internalProtoView(protoViewRef: ProtoViewRef): viewModule.AppPro return isPresent(protoViewRef) ? protoViewRef._protoView : null; } +export interface HostViewRef {} + /** * A reference to an Angular View. * @@ -53,17 +55,20 @@ export function internalProtoView(protoViewRef: ProtoViewRef): viewModule.AppPro * The outter/inner {@link ProtoViewRef}s are then assembled into views like so: * * ``` - * + * * Count: 2 *
    * *
  • first
  • *
  • second
  • *
- * + * * ``` */ -export class ViewRef { +export class ViewRef implements HostViewRef { + /** + * @private + */ constructor(public _view: viewModule.AppView) {} /** @@ -77,9 +82,10 @@ export class ViewRef { get renderFragment(): RenderFragmentRef { return this._view.renderFragment; } /** - * Set local variable for a view. - * + * Set local variable in a view. * + * - `contextName` - Name of the local variable in a view. + * - `value` - Value for the local variable in a view. */ setLocal(contextName: string, value: any): void { this._view.setLocal(contextName, value); } } diff --git a/modules/angular2/src/core/life_cycle/life_cycle.ts b/modules/angular2/src/core/life_cycle/life_cycle.ts index 227014696e..996a434426 100644 --- a/modules/angular2/src/core/life_cycle/life_cycle.ts +++ b/modules/angular2/src/core/life_cycle/life_cycle.ts @@ -1,5 +1,5 @@ import {Injectable} from 'angular2/di'; -import {ChangeDetector} from 'angular2/change_detection'; +import {ChangeDetector} from 'angular2/src/change_detection/change_detection'; import {NgZone} from 'angular2/src/core/zone/ng_zone'; import {isPresent, BaseException} from 'angular2/src/facade/lang'; diff --git a/modules/angular2/src/render/api.ts b/modules/angular2/src/render/api.ts index 5884bf2df8..7404e9f580 100644 --- a/modules/angular2/src/render/api.ts +++ b/modules/angular2/src/render/api.ts @@ -1,7 +1,7 @@ import {isPresent, isBlank, RegExpWrapper} from 'angular2/src/facade/lang'; import {Promise} from 'angular2/src/facade/async'; import {List, Map, MapWrapper, StringMap, StringMapWrapper} from 'angular2/src/facade/collection'; -import {ASTWithSource} from 'angular2/change_detection'; +import {ASTWithSource} from 'angular2/src/change_detection/change_detection'; /** * General notes: @@ -354,7 +354,7 @@ export class RenderViewWithFragments { } /** - * Abstract reference to the element which can be marshaled across web-worker boundry. + * Abstract reference to the element which can be marshaled across web-worker boundary. * * This interface is used by the Renderer API. */ diff --git a/modules/angular2/src/render/dom/compiler/compile_step_factory.ts b/modules/angular2/src/render/dom/compiler/compile_step_factory.ts index 5de2bb559f..5fb3092f41 100644 --- a/modules/angular2/src/render/dom/compiler/compile_step_factory.ts +++ b/modules/angular2/src/render/dom/compiler/compile_step_factory.ts @@ -1,5 +1,5 @@ import {List} from 'angular2/src/facade/collection'; -import {Parser} from 'angular2/change_detection'; +import {Parser} from 'angular2/src/change_detection/change_detection'; import {ViewDefinition} from '../../api'; import {CompileStep} from './compile_step'; import {PropertyBindingParser} from './property_binding_parser'; diff --git a/modules/angular2/src/render/dom/compiler/compiler.ts b/modules/angular2/src/render/dom/compiler/compiler.ts index 4927cb8955..5d003fbb91 100644 --- a/modules/angular2/src/render/dom/compiler/compiler.ts +++ b/modules/angular2/src/render/dom/compiler/compiler.ts @@ -16,7 +16,7 @@ import { import {CompilePipeline} from './compile_pipeline'; import {ViewLoader} from 'angular2/src/render/dom/compiler/view_loader'; import {CompileStepFactory, DefaultStepFactory} from './compile_step_factory'; -import {Parser} from 'angular2/change_detection'; +import {Parser} from 'angular2/src/change_detection/change_detection'; import {ShadowDomStrategy} from '../shadow_dom/shadow_dom_strategy'; import * as pvm from '../view/proto_view_merger'; diff --git a/modules/angular2/src/render/dom/compiler/directive_parser.ts b/modules/angular2/src/render/dom/compiler/directive_parser.ts index 3151cc11c5..1afa147a41 100644 --- a/modules/angular2/src/render/dom/compiler/directive_parser.ts +++ b/modules/angular2/src/render/dom/compiler/directive_parser.ts @@ -1,7 +1,7 @@ import {isPresent, isBlank, BaseException, StringWrapper} from 'angular2/src/facade/lang'; import {List, MapWrapper, ListWrapper} from 'angular2/src/facade/collection'; import {DOM} from 'angular2/src/dom/dom_adapter'; -import {Parser} from 'angular2/change_detection'; +import {Parser} from 'angular2/src/change_detection/change_detection'; import {SelectorMatcher, CssSelector} from 'angular2/src/render/dom/compiler/selector'; diff --git a/modules/angular2/src/render/dom/compiler/property_binding_parser.ts b/modules/angular2/src/render/dom/compiler/property_binding_parser.ts index 0b2bf15fe7..66a4bd22fb 100644 --- a/modules/angular2/src/render/dom/compiler/property_binding_parser.ts +++ b/modules/angular2/src/render/dom/compiler/property_binding_parser.ts @@ -1,7 +1,7 @@ import {isPresent, RegExpWrapper, StringWrapper} from 'angular2/src/facade/lang'; import {MapWrapper} from 'angular2/src/facade/collection'; -import {Parser} from 'angular2/change_detection'; +import {Parser} from 'angular2/src/change_detection/change_detection'; import {CompileStep} from './compile_step'; import {CompileElement} from './compile_element'; diff --git a/modules/angular2/src/render/dom/compiler/text_interpolation_parser.ts b/modules/angular2/src/render/dom/compiler/text_interpolation_parser.ts index dfa7f8da6d..df0b5ca914 100644 --- a/modules/angular2/src/render/dom/compiler/text_interpolation_parser.ts +++ b/modules/angular2/src/render/dom/compiler/text_interpolation_parser.ts @@ -1,7 +1,7 @@ import {RegExpWrapper, StringWrapper, isPresent} from 'angular2/src/facade/lang'; import {DOM} from 'angular2/src/dom/dom_adapter'; -import {Parser} from 'angular2/change_detection'; +import {Parser} from 'angular2/src/change_detection/change_detection'; import {CompileStep} from './compile_step'; import {CompileElement} from './compile_element'; diff --git a/modules/angular2/src/render/dom/compiler/view_splitter.ts b/modules/angular2/src/render/dom/compiler/view_splitter.ts index 19b0620c79..10a94cafe8 100644 --- a/modules/angular2/src/render/dom/compiler/view_splitter.ts +++ b/modules/angular2/src/render/dom/compiler/view_splitter.ts @@ -1,7 +1,7 @@ import {isBlank, isPresent, BaseException, StringWrapper} from 'angular2/src/facade/lang'; import {DOM} from 'angular2/src/dom/dom_adapter'; import {MapWrapper, ListWrapper} from 'angular2/src/facade/collection'; -import {Parser} from 'angular2/change_detection'; +import {Parser} from 'angular2/src/change_detection/change_detection'; import {CompileStep} from './compile_step'; import {CompileElement} from './compile_element'; diff --git a/modules/angular2/src/render/dom/view/element_binder.ts b/modules/angular2/src/render/dom/view/element_binder.ts index 67ac3201b3..d0c37991f7 100644 --- a/modules/angular2/src/render/dom/view/element_binder.ts +++ b/modules/angular2/src/render/dom/view/element_binder.ts @@ -1,4 +1,4 @@ -import {AST} from 'angular2/change_detection'; +import {AST} from 'angular2/src/change_detection/change_detection'; import {List, ListWrapper} from 'angular2/src/facade/collection'; import {isPresent} from 'angular2/src/facade/lang'; diff --git a/modules/angular2/src/render/dom/view/proto_view_builder.ts b/modules/angular2/src/render/dom/view/proto_view_builder.ts index 4208b8094c..f76dc58f4f 100644 --- a/modules/angular2/src/render/dom/view/proto_view_builder.ts +++ b/modules/angular2/src/render/dom/view/proto_view_builder.ts @@ -16,7 +16,7 @@ import { AccessMember, LiteralArray, ImplicitReceiver -} from 'angular2/change_detection'; +} from 'angular2/src/change_detection/change_detection'; import {DomProtoView, DomProtoViewRef, resolveInternalDomProtoView} from './proto_view'; import {DomElementBinder, Event, HostAction} from './element_binder'; diff --git a/modules/angular2/src/test_lib/spies.ts b/modules/angular2/src/test_lib/spies.ts index a1eea19765..3a086cac11 100644 --- a/modules/angular2/src/test_lib/spies.ts +++ b/modules/angular2/src/test_lib/spies.ts @@ -2,7 +2,7 @@ import { ChangeDetector, ProtoChangeDetector, DynamicChangeDetector -} from 'angular2/change_detection'; +} from 'angular2/src/change_detection/change_detection'; import {DependencyProvider} from 'angular2/di'; @@ -23,4 +23,4 @@ export class SpyPipe extends SpyObject { export class SpyPipeFactory extends SpyObject {} -export class SpyDependencyProvider extends SpyObject {} \ No newline at end of file +export class SpyDependencyProvider extends SpyObject {} diff --git a/modules/angular2/src/test_lib/test_component_builder.ts b/modules/angular2/src/test_lib/test_component_builder.ts index 0bce97f99d..d212fb8b5d 100644 --- a/modules/angular2/src/test_lib/test_component_builder.ts +++ b/modules/angular2/src/test_lib/test_component_builder.ts @@ -8,7 +8,7 @@ import {View} from 'angular2/src/core/annotations_impl/view'; import {ViewResolver} from 'angular2/src/core/compiler/view_resolver'; import {AppView} from 'angular2/src/core/compiler/view'; -import {internalView} from 'angular2/src/core/compiler/view_ref'; +import {internalView, ViewRef} from 'angular2/src/core/compiler/view_ref'; import { DynamicComponentLoader, ComponentRef @@ -26,9 +26,9 @@ export class RootTestComponent extends DebugElement { _componentParentView: AppView; constructor(componentRef: ComponentRef) { - super(internalView(componentRef.hostView), 0); + super(internalView(componentRef.hostView), 0); - this._componentParentView = internalView(componentRef.hostView); + this._componentParentView = internalView(componentRef.hostView); this._componentRef = componentRef; } diff --git a/modules/angular2/src/test_lib/test_injector.ts b/modules/angular2/src/test_lib/test_injector.ts index 36347649cd..ed357d9fb0 100644 --- a/modules/angular2/src/test_lib/test_injector.ts +++ b/modules/angular2/src/test_lib/test_injector.ts @@ -9,7 +9,7 @@ import { DynamicChangeDetection, Pipes, defaultPipes -} from 'angular2/change_detection'; +} from 'angular2/src/change_detection/change_detection'; import {ExceptionHandler} from 'angular2/src/core/exception_handler'; import {ViewLoader} from 'angular2/src/render/dom/compiler/view_loader'; import {ViewResolver} from 'angular2/src/core/compiler/view_resolver'; diff --git a/modules/angular2/test/change_detection/change_detection_spec.ts b/modules/angular2/test/change_detection/change_detection_spec.ts index c11095fad0..3e8592e772 100644 --- a/modules/angular2/test/change_detection/change_detection_spec.ts +++ b/modules/angular2/test/change_detection/change_detection_spec.ts @@ -14,7 +14,7 @@ import { PreGeneratedChangeDetection, ChangeDetectorDefinition, DynamicProtoChangeDetector -} from 'angular2/change_detection'; +} from 'angular2/src/change_detection/change_detection'; export function main() { describe("PreGeneratedChangeDetection", () => { diff --git a/modules/angular2/test/change_detection/change_detector_config.ts b/modules/angular2/test/change_detection/change_detector_config.ts index 9c52bc882f..16f5844377 100644 --- a/modules/angular2/test/change_detection/change_detector_config.ts +++ b/modules/angular2/test/change_detection/change_detector_config.ts @@ -10,7 +10,7 @@ import { Lexer, Locals, Parser -} from 'angular2/change_detection'; +} from 'angular2/src/change_detection/change_detection'; import {reflector} from 'angular2/src/reflection/reflection'; import {ReflectionCapabilities} from 'angular2/src/reflection/reflection_capabilities'; diff --git a/modules/angular2/test/change_detection/change_detector_spec.ts b/modules/angular2/test/change_detection/change_detector_spec.ts index 882ac95378..f74e2ed694 100644 --- a/modules/angular2/test/change_detection/change_detector_spec.ts +++ b/modules/angular2/test/change_detection/change_detector_spec.ts @@ -44,7 +44,7 @@ import { Parser, Locals, ProtoChangeDetector -} from 'angular2/change_detection'; +} from 'angular2/src/change_detection/change_detection'; import {JitProtoChangeDetector} from 'angular2/src/change_detection/jit_proto_change_detector'; import {getDefinition} from './change_detector_config'; diff --git a/modules/angular2/test/core/compiler/element_injector_spec.ts b/modules/angular2/test/core/compiler/element_injector_spec.ts index 581bab1b6a..807119a2a5 100644 --- a/modules/angular2/test/core/compiler/element_injector_spec.ts +++ b/modules/angular2/test/core/compiler/element_injector_spec.ts @@ -45,7 +45,7 @@ import {AppProtoView, AppView} from 'angular2/src/core/compiler/view'; import {ViewContainerRef} from 'angular2/src/core/compiler/view_container_ref'; import {TemplateRef} from 'angular2/src/core/compiler/template_ref'; import {ElementRef} from 'angular2/src/core/compiler/element_ref'; -import {DynamicChangeDetector, ChangeDetectorRef, Parser, Lexer} from 'angular2/change_detection'; +import {DynamicChangeDetector, ChangeDetectorRef, Parser, Lexer} from 'angular2/src/change_detection/change_detection'; import {QueryList} from 'angular2/src/core/compiler/query_list'; @proxy diff --git a/modules/angular2/test/core/compiler/integration_spec.ts b/modules/angular2/test/core/compiler/integration_spec.ts index 5c1c2cd507..ef15f83779 100644 --- a/modules/angular2/test/core/compiler/integration_spec.ts +++ b/modules/angular2/test/core/compiler/integration_spec.ts @@ -53,7 +53,7 @@ import { Pipe, ChangeDetectorRef, ON_PUSH -} from 'angular2/change_detection'; +} from 'angular2/src/change_detection/change_detection'; import {Directive, Component, View, Attribute, Query} from 'angular2/annotations'; import * as viewAnn from 'angular2/src/core/annotations_impl/view'; diff --git a/modules/angular2/test/core/compiler/proto_view_factory_spec.ts b/modules/angular2/test/core/compiler/proto_view_factory_spec.ts index 9c2809e535..157523a224 100644 --- a/modules/angular2/test/core/compiler/proto_view_factory_spec.ts +++ b/modules/angular2/test/core/compiler/proto_view_factory_spec.ts @@ -17,7 +17,10 @@ import { import {isBlank, IMPLEMENTS, stringify} from 'angular2/src/facade/lang'; import {MapWrapper} from 'angular2/src/facade/collection'; -import {ChangeDetection, ChangeDetectorDefinition} from 'angular2/change_detection'; +import { + ChangeDetection, + ChangeDetectorDefinition +} from 'angular2/src/change_detection/change_detection'; import { ProtoViewFactory, getChangeDetectorDefinitions, diff --git a/modules/angular2/test/core/compiler/view_manager_spec.ts b/modules/angular2/test/core/compiler/view_manager_spec.ts index a742831e06..6b09185436 100644 --- a/modules/angular2/test/core/compiler/view_manager_spec.ts +++ b/modules/angular2/test/core/compiler/view_manager_spec.ts @@ -115,21 +115,23 @@ export function main() { () => { hostProtoView = createHostPv([createNestedElBinder(createComponentPv())]); }); it('should create the view', () => { - var rootView = internalView(manager.createRootHostView(wrapPv(hostProtoView), null, null)); + var rootView = + internalView(manager.createRootHostView(wrapPv(hostProtoView), null, null)); expect(rootView.proto).toBe(hostProtoView); expect(viewListener.spy('viewCreated')).toHaveBeenCalledWith(rootView); }); it('should hydrate the view', () => { var injector = Injector.resolveAndCreate([]); - var rootView = - internalView(manager.createRootHostView(wrapPv(hostProtoView), null, injector)); + var rootView = internalView( + manager.createRootHostView(wrapPv(hostProtoView), null, injector)); expect(rootView.hydrated()).toBe(true); expect(renderer.spy('hydrateView')).toHaveBeenCalledWith(rootView.render); }); it('should create and set the render view using the component selector', () => { - var rootView = internalView(manager.createRootHostView(wrapPv(hostProtoView), null, null)); + var rootView = + internalView(manager.createRootHostView(wrapPv(hostProtoView), null, null)); expect(renderer.spy('createRootHostView')) .toHaveBeenCalledWith(hostProtoView.mergeMapping.renderProtoViewRef, hostProtoView.mergeMapping.renderFragmentCount, 'someComponent'); @@ -139,14 +141,15 @@ export function main() { it('should allow to override the selector', () => { var selector = 'someOtherSelector'; - internalView(manager.createRootHostView(wrapPv(hostProtoView), selector, null)); + internalView(manager.createRootHostView(wrapPv(hostProtoView), selector, null)); expect(renderer.spy('createRootHostView')) .toHaveBeenCalledWith(hostProtoView.mergeMapping.renderProtoViewRef, hostProtoView.mergeMapping.renderFragmentCount, selector); }); it('should set the event dispatcher', () => { - var rootView = internalView(manager.createRootHostView(wrapPv(hostProtoView), null, null)); + var rootView = + internalView(manager.createRootHostView(wrapPv(hostProtoView), null, null)); expect(renderer.spy('setEventDispatcher')).toHaveBeenCalledWith(rootView.render, rootView); }); @@ -159,7 +162,8 @@ export function main() { var hostRenderViewRef: RenderViewRef; beforeEach(() => { hostProtoView = createHostPv([createNestedElBinder(createComponentPv())]); - hostView = internalView(manager.createRootHostView(wrapPv(hostProtoView), null, null)); + hostView = + internalView(manager.createRootHostView(wrapPv(hostProtoView), null, null)); hostRenderViewRef = hostView.render; }); @@ -193,7 +197,8 @@ export function main() { childProtoView = createEmbeddedPv(); var hostProtoView = createHostPv( [createNestedElBinder(createComponentPv([createNestedElBinder(childProtoView)]))]); - hostView = internalView(manager.createRootHostView(wrapPv(hostProtoView), null, null)); + hostView = + internalView(manager.createRootHostView(wrapPv(hostProtoView), null, null)); vcRef = hostView.elementRefs[1]; templateRef = new TemplateRef(hostView.elementRefs[1]); resetSpies(); @@ -307,8 +312,8 @@ export function main() { it('should always create a new view and not use the embedded view', () => { var newHostPv = createHostPv([createNestedElBinder(createComponentPv())]); - var newHostView = - internalView(manager.createHostViewInContainer(vcRef, 0, wrapPv(newHostPv), null)); + var newHostView = internalView( + manager.createHostViewInContainer(vcRef, 0, wrapPv(newHostPv), null)); expect(newHostView.proto).toBe(newHostPv); expect(newHostView).not.toBe(hostView.views[2]); expect(viewListener.spy('viewCreated')).toHaveBeenCalledWith(newHostView); @@ -334,7 +339,8 @@ export function main() { childProtoView = createEmbeddedPv(); var hostProtoView = createHostPv( [createNestedElBinder(createComponentPv([createNestedElBinder(childProtoView)]))]); - hostView = internalView(manager.createRootHostView(wrapPv(hostProtoView), null, null)); + hostView = + internalView(manager.createRootHostView(wrapPv(hostProtoView), null, null)); vcRef = hostView.elementRefs[1]; templateRef = new TemplateRef(hostView.elementRefs[1]); firstChildView = @@ -405,7 +411,8 @@ export function main() { childProtoView = createEmbeddedPv(); var hostProtoView = createHostPv( [createNestedElBinder(createComponentPv([createNestedElBinder(childProtoView)]))]); - hostView = internalView(manager.createRootHostView(wrapPv(hostProtoView), null, null)); + hostView = internalView( + manager.createRootHostView(wrapPv(hostProtoView), null, null)); vcRef = hostView.elementRefs[1]; templateRef = new TemplateRef(hostView.elementRefs[1]); firstChildView = @@ -457,7 +464,8 @@ export function main() { ]); var hostProtoView = createHostPv( [createNestedElBinder(createComponentPv([createNestedElBinder(childProtoView)]))]); - hostView = internalView(manager.createRootHostView(wrapPv(hostProtoView), null, null)); + hostView = internalView( + manager.createRootHostView(wrapPv(hostProtoView), null, null)); vcRef = hostView.elementRefs[1]; templateRef = new TemplateRef(hostView.elementRefs[1]); nestedChildViews = []; diff --git a/modules/angular2/test/render/dom/compiler/directive_parser_spec.ts b/modules/angular2/test/render/dom/compiler/directive_parser_spec.ts index 53dd2230b4..72e6d078ec 100644 --- a/modules/angular2/test/render/dom/compiler/directive_parser_spec.ts +++ b/modules/angular2/test/render/dom/compiler/directive_parser_spec.ts @@ -8,7 +8,7 @@ import {CompileStep} from 'angular2/src/render/dom/compiler/compile_step'; import {CompileElement} from 'angular2/src/render/dom/compiler/compile_element'; import {CompileControl} from 'angular2/src/render/dom/compiler/compile_control'; import {ViewDefinition, DirectiveMetadata} from 'angular2/src/render/api'; -import {Lexer, Parser} from 'angular2/change_detection'; +import {Lexer, Parser} from 'angular2/src/change_detection/change_detection'; import {ElementBinderBuilder} from 'angular2/src/render/dom/view/proto_view_builder'; export function main() { diff --git a/modules/angular2/test/render/dom/compiler/property_binding_parser_spec.ts b/modules/angular2/test/render/dom/compiler/property_binding_parser_spec.ts index 2e49fbd805..59124152b2 100644 --- a/modules/angular2/test/render/dom/compiler/property_binding_parser_spec.ts +++ b/modules/angular2/test/render/dom/compiler/property_binding_parser_spec.ts @@ -6,7 +6,7 @@ import {MapWrapper, ListWrapper} from 'angular2/src/facade/collection'; import {CompileElement} from 'angular2/src/render/dom/compiler/compile_element'; import {CompileStep} from 'angular2/src/render/dom/compiler/compile_step'; import {CompileControl} from 'angular2/src/render/dom/compiler/compile_control'; -import {Lexer, Parser} from 'angular2/change_detection'; +import {Lexer, Parser} from 'angular2/src/change_detection/change_detection'; import {ElementBinderBuilder} from 'angular2/src/render/dom/view/proto_view_builder'; var EMPTY_MAP = new Map(); diff --git a/modules/angular2/test/render/dom/compiler/text_interpolation_parser_spec.ts b/modules/angular2/test/render/dom/compiler/text_interpolation_parser_spec.ts index b34ce4ee51..baa8a5e96d 100644 --- a/modules/angular2/test/render/dom/compiler/text_interpolation_parser_spec.ts +++ b/modules/angular2/test/render/dom/compiler/text_interpolation_parser_spec.ts @@ -2,7 +2,7 @@ import {describe, beforeEach, expect, it, iit, ddescribe, el} from 'angular2/tes import {TextInterpolationParser} from 'angular2/src/render/dom/compiler/text_interpolation_parser'; import {CompilePipeline} from 'angular2/src/render/dom/compiler/compile_pipeline'; import {MapWrapper, ListWrapper} from 'angular2/src/facade/collection'; -import {Lexer, Parser, ASTWithSource} from 'angular2/change_detection'; +import {Lexer, Parser, ASTWithSource} from 'angular2/src/change_detection/change_detection'; import {IgnoreChildrenStep} from './pipeline_spec'; import { ProtoViewBuilder, diff --git a/modules/angular2/test/render/dom/compiler/view_splitter_spec.ts b/modules/angular2/test/render/dom/compiler/view_splitter_spec.ts index f336735072..37d33b1ae8 100644 --- a/modules/angular2/test/render/dom/compiler/view_splitter_spec.ts +++ b/modules/angular2/test/render/dom/compiler/view_splitter_spec.ts @@ -15,7 +15,7 @@ import {CompilePipeline} from 'angular2/src/render/dom/compiler/compile_pipeline import {ProtoViewDto, ViewType} from 'angular2/src/render/api'; import {DOM} from 'angular2/src/dom/dom_adapter'; -import {Lexer, Parser} from 'angular2/change_detection'; +import {Lexer, Parser} from 'angular2/src/change_detection/change_detection'; export function main() { describe('ViewSplitter', () => { diff --git a/modules/angular2/test/render/dom/view/proto_view_builder_spec.ts b/modules/angular2/test/render/dom/view/proto_view_builder_spec.ts index f7311725c8..834daf8ff2 100644 --- a/modules/angular2/test/render/dom/view/proto_view_builder_spec.ts +++ b/modules/angular2/test/render/dom/view/proto_view_builder_spec.ts @@ -12,7 +12,7 @@ import { } from 'angular2/test_lib'; import {ProtoViewBuilder} from 'angular2/src/render/dom/view/proto_view_builder'; -import {ASTWithSource, AST} from 'angular2/change_detection'; +import {ASTWithSource, AST} from 'angular2/src/change_detection/change_detection'; import {PropertyBindingType, ViewType} from 'angular2/src/render/api'; import {DOM} from 'angular2/src/dom/dom_adapter'; diff --git a/modules/angular2/test/test_lib/fake_async_spec.ts b/modules/angular2/test/test_lib/fake_async_spec.ts index a9d34ab430..f7889ff00c 100644 --- a/modules/angular2/test/test_lib/fake_async_spec.ts +++ b/modules/angular2/test/test_lib/fake_async_spec.ts @@ -16,7 +16,7 @@ import { } from 'angular2/test_lib'; import {TimerWrapper, PromiseWrapper} from 'angular2/src/facade/async'; import {BaseException, global} from 'angular2/src/facade/lang'; -import {Parser} from 'angular2/change_detection'; +import {Parser} from 'angular2/src/change_detection/change_detection'; export function main() { describe('fake async', () => { diff --git a/modules/benchmarks/src/change_detection/change_detection_benchmark.ts b/modules/benchmarks/src/change_detection/change_detection_benchmark.ts index 0357a35750..527248b8d9 100644 --- a/modules/benchmarks/src/change_detection/change_detection_benchmark.ts +++ b/modules/benchmarks/src/change_detection/change_detection_benchmark.ts @@ -15,7 +15,7 @@ import { DirectiveRecord, DirectiveIndex, DEFAULT -} from 'angular2/change_detection'; +} from 'angular2/src/change_detection/change_detection'; // ---- SHARED diff --git a/modules/benchmarks/src/compiler/compiler_benchmark.ts b/modules/benchmarks/src/compiler/compiler_benchmark.ts index 745f866910..e53c648fa2 100644 --- a/modules/benchmarks/src/compiler/compiler_benchmark.ts +++ b/modules/benchmarks/src/compiler/compiler_benchmark.ts @@ -6,7 +6,11 @@ import { NativeShadowDomStrategy } from 'angular2/src/render/dom/shadow_dom/native_shadow_dom_strategy'; -import {Parser, Lexer, DynamicChangeDetection} from 'angular2/change_detection'; +import { + Parser, + Lexer, + DynamicChangeDetection +} from 'angular2/src/change_detection/change_detection'; import {Compiler, CompilerCache} from 'angular2/src/core/compiler/compiler'; import {DirectiveResolver} from 'angular2/src/core/compiler/directive_resolver'; diff --git a/tools/broccoli/diffing-broccoli-plugin.ts b/tools/broccoli/diffing-broccoli-plugin.ts index 636d44d1d8..4ab3d36109 100644 --- a/tools/broccoli/diffing-broccoli-plugin.ts +++ b/tools/broccoli/diffing-broccoli-plugin.ts @@ -124,7 +124,7 @@ class DiffingPluginWrapper implements BroccoliTree { cleanup() { - if (this.wrappedPlugin.cleanup) { + if (this.wrappedPlugin && this.wrappedPlugin.cleanup) { this.wrappedPlugin.cleanup(); } }