refactor(core): rename ViewContainer to ViewContainerRef

This also renames InternalAppViewContainer into AppViewContainer

Related to #1477
Closes #1554
This commit is contained in:
Tobias Bosch 2015-04-27 09:26:55 -07:00
parent 0676fef61f
commit 6dece68bb8
22 changed files with 145 additions and 147 deletions

View File

@ -23,7 +23,7 @@ export * from './src/render/dom/shadow_dom/emulated_unscoped_shadow_dom_strategy
export * from './src/core/compiler/dynamic_component_loader';
export {ElementRef, ComponentRef} from './src/core/compiler/element_injector';
export * from './src/core/compiler/view';
export * from './src/core/compiler/view_container';
export * from './src/core/compiler/view_container_ref';
export * from './src/core/compiler/ng_element';

View File

@ -169,8 +169,8 @@ Viewport is a directive which can control instantiation of child views which are
* Viewports can only be placed on `<template>` elements (or the short hand version which uses `<element template>` attribute.)
* Only one viewport can be present per DOM template element.
* The viewport is created over the `template` element. This is known as the `ViewContainer`.
* Viewport can insert child views into the `ViewContainer`. The child views show up as siblings of the `Viewport` in the DOM.
* The viewport is created over the `template` element. This is known as the `ViewContainerRef`.
* Viewport can insert child views into the `ViewContainerRef`. The child views show up as siblings of the `Viewport` in the DOM.
>> TODO(misko): Relationship with Injection
>> TODO(misko): Instantiator can not be injected into child Views
@ -184,10 +184,10 @@ Viewport is a directive which can control instantiation of child views which are
}
})
export class If {
viewContainer: ViewContainer;
viewContainer: ViewContainerRef;
view: View;
constructor(viewContainer: ViewContainer) {
constructor(viewContainer: ViewContainerRef) {
this.viewContainer = viewContainer;
this.view = null;
}

View File

@ -5,7 +5,7 @@
This document explains the concept of a View.
A View is a core primitive used by angular to render the DOM tree.
A ViewPort is location in a View which can accept child Views.
Every ViewPort has an associated ViewContainer than can contain any number of child Views.
Every ViewPort has an associated ViewContainerRef than can contain any number of child Views.
Views form a tree structure which mimics the DOM tree.
* View is a core rendering construct. A running application is just a collection of Views which are
@ -123,11 +123,11 @@ The next step is to compose these two ProtoViews into an actual view which is re
</ul> | viewA(someContext)
```
*Step2:* Instantiate `Foreach` directive which will receive the `ViewContainer`. (The ViewContainer
*Step2:* Instantiate `Foreach` directive which will receive the `ViewContainerRef`. (The ViewContainerRef
has a reference to `protoViewA`).
*Step3:* As the `Foreach` directive unrolls it asks the `ViewContainer` to instantiate `protoViewB` and insert
*Step3:* As the `Foreach` directive unrolls it asks the `ViewContainerRef` to instantiate `protoViewB` and insert
it after the `ViewPort` anchor. This is repeated for each `person` in `people`. Notice that
```
@ -233,8 +233,8 @@ the locals, and then the `Greeter` instance.
Views transition through a particular set of states:
1. View is created from the ProtoView.
2. View can be attached to an existing ViewContainer.
3. Upon attaching View to the ViewContainer the View needs to be hydrated. The hydration process
2. View can be attached to an existing ViewContainerRef.
3. Upon attaching View to the ViewContainerRef the View needs to be hydrated. The hydration process
involves instantiating all of the Directives associated with the current View.
4. At this point the view is ready and renderable. Multiple changes can be delivered to the
Directives from the ChangeDetection.

View File

@ -55,7 +55,7 @@ import {DEFAULT} from 'angular2/change_detection';
*
* To inject element-specific special objects, declare the constructor parameter as:
* - `element: NgElement` to obtain a DOM element (DEPRECATED: replacement coming)
* - `viewContainer: ViewContainer` to control child template instantiation, for {@link Viewport} directives only
* - `viewContainer: ViewContainerRef` to control child template instantiation, for {@link Viewport} directives only
* - `bindingPropagation: BindingPropagation` to control change detection in a more granular way.
*
* ## Example
@ -827,8 +827,8 @@ export class Decorator extends Directive {
/**
* Directive that controls the instantiation, destruction, and positioning of inline template elements.
*
* A viewport directive uses a {@link ViewContainer} to instantiate, insert, move, and destroy views at runtime.
* The {@link ViewContainer} is created as a result of `<template>` element, and represents a location in the current view
* A viewport directive uses a {@link ViewContainerRef} to instantiate, insert, move, and destroy views at runtime.
* The {@link ViewContainerRef} is created as a result of `<template>` element, and represents a location in the current view
* where these actions are performed.
*
* Views are always created as children of the current {@link View}, and as siblings of the `<template>` element. Thus a
@ -873,10 +873,10 @@ export class Decorator extends Directive {
* }
* })
* export class Unless {
* viewContainer: ViewContainer;
* viewContainer: ViewContainerRef;
* prevCondition: boolean;
*
* constructor(viewContainer: ViewContainer) {
* constructor(viewContainer: ViewContainerRef) {
* this.viewContainer = viewContainer;
* this.prevCondition = null;
* }

View File

@ -8,7 +8,7 @@ import {Parent, Ancestor} from 'angular2/src/core/annotations/visibility';
import {Attribute, Query} from 'angular2/src/core/annotations/di';
import * as viewModule from 'angular2/src/core/compiler/view';
import * as avmModule from './view_manager';
import {ViewContainer} from 'angular2/src/core/compiler/view_container';
import {ViewContainerRef} from 'angular2/src/core/compiler/view_container_ref';
import {NgElement} from 'angular2/src/core/compiler/ng_element';
import {Directive, Component, onChange, onDestroy, onAllChangesDone} from 'angular2/src/core/annotations/annotations';
import {ChangeDetector, ChangeDetectorRef} from 'angular2/change_detection';
@ -31,14 +31,14 @@ export class ElementRef {
boundElementIndex:number;
injector:Injector;
elementInjector:ElementInjector;
viewContainer:ViewContainer;
viewContainer:ViewContainerRef;
constructor(elementInjector, hostView, boundElementIndex, injector, viewManager, defaultProtoView){
this.elementInjector = elementInjector;
this.hostView = hostView;
this.boundElementIndex = boundElementIndex;
this.injector = injector;
this.viewContainer = new ViewContainer(viewManager, this, defaultProtoView);
this.viewContainer = new ViewContainerRef(viewManager, this, defaultProtoView);
}
}
@ -57,7 +57,7 @@ class StaticKeys {
this.defaultProtoViewId = Key.get(viewModule.AppProtoView).id;
this.viewId = Key.get(viewModule.AppView).id;
this.ngElementId = Key.get(NgElement).id;
this.viewContainerId = Key.get(ViewContainer).id;
this.viewContainerId = Key.get(ViewContainerRef).id;
this.changeDetectorRefId = Key.get(ChangeDetectorRef).id;
this.elementRefId = Key.get(ElementRef).id;
}

View File

@ -8,9 +8,7 @@ import {SetterFn} from 'angular2/src/reflection/types';
import {IMPLEMENTS, int, isPresent, isBlank, BaseException} from 'angular2/src/facade/lang';
import * as renderApi from 'angular2/src/render/api';
// TODO(tbosch): rename ViewContainer -> ViewContainerRef
// and InternalAppViewContainer -> ViewContainer!
export class InternalAppViewContainer {
export class AppViewContainer {
views: List<AppView>;
constructor() {
@ -36,7 +34,7 @@ export class AppView {
/// Host views that were added by an imperative view.
/// This is a dynamically growing / shrinking array.
imperativeHostViews: List<AppView>;
viewContainers: List<InternalAppViewContainer>;
viewContainers: List<AppViewContainer>;
preBuiltObjects: List<PreBuiltObjects>;
proto: AppProtoView;
renderer: renderApi.Renderer;

View File

@ -9,7 +9,7 @@ import * as avmModule from './view_manager';
/**
* @exportedAs angular2/view
*/
export class ViewContainer {
export class ViewContainerRef {
_viewManager: avmModule.AppViewManager;
_location: eiModule.ElementRef;
_defaultProtoView: viewModule.AppProtoView;

View File

@ -3,7 +3,7 @@ import {ListWrapper, MapWrapper, Map, StringMapWrapper, List} from 'angular2/src
import {isPresent, isBlank, BaseException} from 'angular2/src/facade/lang';
import * as eli from './element_injector';
import * as viewModule from './view';
import {Renderer, ViewRef, ViewContainerRef} from 'angular2/src/render/api';
import {Renderer, ViewRef, RenderViewContainerRef} from 'angular2/src/render/api';
import {AppViewManagerUtils} from './view_manager_utils';
import {AppViewPool} from './view_pool';
@ -121,7 +121,7 @@ export class AppViewManager {
}
_getRenderViewContainerRef(parentView:viewModule.AppView, boundElementIndex:number) {
return new ViewContainerRef(parentView.render, boundElementIndex);
return new RenderViewContainerRef(parentView.render, boundElementIndex);
}
_createViewRecurse(protoView:viewModule.AppProtoView) {

View File

@ -112,7 +112,7 @@ export class AppViewManagerUtils {
parentView.changeDetector.addChild(view.changeDetector);
var viewContainer = parentView.viewContainers[boundElementIndex];
if (isBlank(viewContainer)) {
viewContainer = new viewModule.InternalAppViewContainer();
viewContainer = new viewModule.AppViewContainer();
parentView.viewContainers[boundElementIndex] = viewContainer;
}
ListWrapper.insert(viewContainer.views, atIndex, view);

View File

@ -1,5 +1,5 @@
import {Viewport} from 'angular2/src/core/annotations/annotations';
import {ViewContainer} from 'angular2/src/core/compiler/view_container';
import {ViewContainerRef} from 'angular2/src/core/compiler/view_container_ref';
import {AppView} from 'angular2/src/core/compiler/view';
import {isPresent, isBlank} from 'angular2/src/facade/lang';
import {ListWrapper} from 'angular2/src/facade/collection';
@ -43,8 +43,8 @@ import {ListWrapper} from 'angular2/src/facade/collection';
}
})
export class For {
viewContainer: ViewContainer;
constructor(viewContainer:ViewContainer) {
viewContainer: ViewContainerRef;
constructor(viewContainer:ViewContainerRef) {
this.viewContainer = viewContainer;
}

View File

@ -1,5 +1,5 @@
import {Viewport} from 'angular2/src/core/annotations/annotations';
import {ViewContainer} from 'angular2/src/core/compiler/view_container';
import {ViewContainerRef} from 'angular2/src/core/compiler/view_container_ref';
import {isBlank} from 'angular2/src/facade/lang';
/**
@ -32,10 +32,10 @@ import {isBlank} from 'angular2/src/facade/lang';
}
})
export class If {
viewContainer: ViewContainer;
viewContainer: ViewContainerRef;
prevCondition: boolean;
constructor(viewContainer: ViewContainer) {
constructor(viewContainer: ViewContainerRef) {
this.viewContainer = viewContainer;
this.prevCondition = null;
}

View File

@ -1,5 +1,5 @@
import {Decorator, Viewport} from 'angular2/src/core/annotations/annotations';
import {ViewContainer} from 'angular2/src/core/compiler/view_container';
import {ViewContainerRef} from 'angular2/src/core/compiler/view_container_ref';
import {isPresent, isBlank, normalizeBlank} from 'angular2/src/facade/lang';
import {ListWrapper, List, MapWrapper, Map} from 'angular2/src/facade/collection';
import {Parent} from 'angular2/src/core/annotations/visibility';
@ -41,7 +41,7 @@ export class Switch {
_switchValue: any;
_useDefault: boolean;
_valueViewContainers: Map;
_activeViewContainers: List<ViewContainer>;
_activeViewContainers: List<ViewContainerRef>;
constructor() {
this._valueViewContainers = MapWrapper.create();
@ -65,7 +65,7 @@ export class Switch {
this._switchValue = value;
}
_onWhenValueChanged(oldWhen, newWhen, viewContainer: ViewContainer):void {
_onWhenValueChanged(oldWhen, newWhen, viewContainer: ViewContainerRef):void {
this._deregisterViewContainer(oldWhen, viewContainer);
this._registerViewContainer(newWhen, viewContainer);
@ -96,7 +96,7 @@ export class Switch {
this._activeViewContainers = ListWrapper.create();
}
_activateViewContainers(containers: List<ViewContainer>):void {
_activateViewContainers(containers: List<ViewContainerRef>):void {
// TODO(vicb): assert(this._activeViewContainers.length === 0);
if (isPresent(containers)) {
for (var i = 0; i < containers.length; i++) {
@ -106,7 +106,7 @@ export class Switch {
}
}
_registerViewContainer(value, container: ViewContainer): void {
_registerViewContainer(value, container: ViewContainerRef): void {
var containers = MapWrapper.get(this._valueViewContainers, value);
if (isBlank(containers)) {
containers = ListWrapper.create();
@ -115,7 +115,7 @@ export class Switch {
ListWrapper.push(containers, container);
}
_deregisterViewContainer(value, container: ViewContainer):void {
_deregisterViewContainer(value, container: ViewContainerRef):void {
// `_whenDefault` is used a marker for non-registered whens
if (value == _whenDefault) return;
var containers = MapWrapper.get(this._valueViewContainers, value);
@ -153,9 +153,9 @@ export class Switch {
export class SwitchWhen {
_value: any;
_switch: Switch;
_viewContainer: ViewContainer;
_viewContainer: ViewContainerRef;
constructor(viewContainer: ViewContainer, @Parent() sswitch: Switch) {
constructor(viewContainer: ViewContainerRef, @Parent() sswitch: Switch) {
// `_whenDefault` is used as a marker for a not yet initialized value
this._value = _whenDefault;
this._switch = sswitch;
@ -186,7 +186,7 @@ export class SwitchWhen {
selector: '[switch-default]'
})
export class SwitchDefault {
constructor(viewContainer: ViewContainer, @Parent() sswitch: Switch) {
constructor(viewContainer: ViewContainerRef, @Parent() sswitch: Switch) {
sswitch._registerViewContainer(_whenDefault, viewContainer);
}
}

View File

@ -138,7 +138,7 @@ export class ProtoViewRef {}
// An opaque reference to a RenderView
export class ViewRef {}
export class ViewContainerRef {
export class RenderViewContainerRef {
view:ViewRef;
elementIndex:number;
constructor(view:ViewRef, elementIndex: number) {
@ -193,27 +193,27 @@ export class Renderer {
/**
* Creates a view and inserts it into a ViewContainer.
* @param {ViewContainerRef} viewContainerRef
* @param {RenderViewContainerRef} viewContainerRef
* @param {ProtoViewRef} protoViewRef A ProtoViewRef of type ProtoViewDto.HOST_VIEW_TYPE or ProtoViewDto.EMBEDDED_VIEW_TYPE
* @param {number} atIndex
* @return {List<ViewRef>} the view and all of its nested child component views
*/
createViewInContainer(vcRef:ViewContainerRef, atIndex:number, protoViewRef:ProtoViewRef):List<ViewRef> { return null; }
createViewInContainer(vcRef:RenderViewContainerRef, atIndex:number, protoViewRef:ProtoViewRef):List<ViewRef> { return null; }
/**
* Destroys the view in the given ViewContainer
*/
destroyViewInContainer(vcRef:ViewContainerRef, atIndex:number):void {}
destroyViewInContainer(vcRef:RenderViewContainerRef, atIndex:number):void {}
/**
* Inserts a detached view into a viewContainer.
*/
insertViewIntoContainer(vcRef:ViewContainerRef, atIndex:number, view:ViewRef):void {}
insertViewIntoContainer(vcRef:RenderViewContainerRef, atIndex:number, view:ViewRef):void {}
/**
* Detaches a view from a container so that it can be inserted later on
*/
detachViewFromContainer(vcRef:ViewContainerRef, atIndex:number):void {}
detachViewFromContainer(vcRef:RenderViewContainerRef, atIndex:number):void {}
/**
* Creates a view and

View File

@ -14,7 +14,7 @@ import {ProtoViewBuilder} from './view/proto_view_builder';
import {DOM} from 'angular2/src/dom/dom_adapter';
import {ViewContainer} from './view/view_container';
function _resolveViewContainer(vc:api.ViewContainerRef) {
function _resolveViewContainer(vc:api.RenderViewContainerRef) {
return _resolveView(vc.view).getOrCreateViewContainer(vc.elementIndex);
}
@ -109,7 +109,7 @@ export class DirectDomRenderer extends api.Renderer {
);
}
createViewInContainer(vcRef:api.ViewContainerRef, atIndex:number, protoViewRef:api.ProtoViewRef):List<api.ViewRef> {
createViewInContainer(vcRef:api.RenderViewContainerRef, atIndex:number, protoViewRef:api.ProtoViewRef):List<api.ViewRef> {
var view = this._viewFactory.getView(_resolveProtoView(protoViewRef));
var vc = _resolveViewContainer(vcRef);
this._viewHydrator.hydrateViewInViewContainer(vc, view);
@ -117,18 +117,18 @@ export class DirectDomRenderer extends api.Renderer {
return _collectComponentChildViewRefs(view);
}
destroyViewInContainer(vcRef:api.ViewContainerRef, atIndex:number):void {
destroyViewInContainer(vcRef:api.RenderViewContainerRef, atIndex:number):void {
var vc = _resolveViewContainer(vcRef);
var view = vc.detach(atIndex);
this._viewHydrator.dehydrateViewInViewContainer(vc, view);
this._viewFactory.returnView(view);
}
insertViewIntoContainer(vcRef:api.ViewContainerRef, atIndex=-1, viewRef:api.ViewRef):void {
insertViewIntoContainer(vcRef:api.RenderViewContainerRef, atIndex=-1, viewRef:api.ViewRef):void {
_resolveViewContainer(vcRef).insert(_resolveView(viewRef), atIndex);
}
detachViewFromContainer(vcRef:api.ViewContainerRef, atIndex:number):void {
detachViewFromContainer(vcRef:api.RenderViewContainerRef, atIndex:number):void {
_resolveViewContainer(vcRef).detach(atIndex);
}

View File

@ -8,7 +8,7 @@ import {Attribute, Query} from 'angular2/src/core/annotations/di';
import {onDestroy} from 'angular2/src/core/annotations/annotations';
import {Optional, Injector, Inject, bind} from 'angular2/di';
import {AppProtoView, AppView} from 'angular2/src/core/compiler/view';
import {ViewContainer} from 'angular2/src/core/compiler/view_container';
import {ViewContainerRef} from 'angular2/src/core/compiler/view_container_ref';
import {NgElement} from 'angular2/src/core/compiler/ng_element';
import {Directive} from 'angular2/src/core/annotations/annotations';
import {DynamicChangeDetector, ChangeDetectorRef, Parser, Lexer} from 'angular2/change_detection';
@ -130,7 +130,7 @@ class NeedsElementRef {
class NeedsViewContainer {
viewContainer;
constructor(vc:ViewContainer) {
constructor(vc:ViewContainerRef) {
this.viewContainer = vc;
}
}
@ -717,9 +717,9 @@ export function main() {
expect(inj.get(NeedsChangeDetectorRef).changeDetectorRef).toBe(cd.ref);
});
it('should inject ViewContainer', () => {
it('should inject ViewContainerRef', () => {
var inj = injector([NeedsViewContainer]);
expect(inj.get(NeedsViewContainer).viewContainer).toBeAnInstanceOf(ViewContainer);
expect(inj.get(NeedsViewContainer).viewContainer).toBeAnInstanceOf(ViewContainerRef);
});
});

View File

@ -31,7 +31,7 @@ import {Attribute} from 'angular2/src/core/annotations/di';
import {If} from 'angular2/src/directives/if';
import {ViewContainer} from 'angular2/src/core/compiler/view_container';
import {ViewContainerRef} from 'angular2/src/core/compiler/view_container_ref';
import {Compiler} from 'angular2/src/core/compiler/compiler';
import {ElementRef} from 'angular2/src/core/compiler/element_injector';
@ -690,7 +690,7 @@ export function main() {
describe('dynamic ViewContainers', () => {
it('should allow to create a ViewContainer at any bound location',
it('should allow to create a ViewContainerRef at any bound location',
inject([TestBed, AsyncTestCompleter, Compiler], (tb, async, compiler) => {
tb.overrideView(MyComp, new View({
template: '<div><dynamic-vp #dynamic></dynamic-vp></div>',
@ -862,7 +862,7 @@ class SimpleImperativeViewComponent {
})
class DynamicViewport {
done;
constructor(vc:ViewContainer, inj:Injector, compiler:Compiler) {
constructor(vc:ViewContainerRef, inj:Injector, compiler:Compiler) {
var myService = new MyService();
myService.greeting = 'dynamic greet';
this.done = compiler.compileInHost(ChildCompUsingService).then( (hostPv) => {
@ -1040,7 +1040,7 @@ class ChildComp2 {
selector: '[some-viewport]'
})
class SomeViewport {
constructor(container: ViewContainer) {
constructor(container: ViewContainerRef) {
container.create().setLocal('some-tmpl', 'hello');
container.create().setLocal('some-tmpl', 'again');
}

View File

@ -19,14 +19,14 @@ import {MapWrapper} from 'angular2/src/facade/collection';
import {IMPLEMENTS, isBlank, isPresent} from 'angular2/src/facade/lang';
import {ElementRef} from 'angular2/src/core/compiler/element_injector';
import {AppView, AppProtoView, InternalAppViewContainer} from 'angular2/src/core/compiler/view';
import {ViewContainer} from 'angular2/src/core/compiler/view_container';
import {AppView, AppProtoView, AppViewContainer} from 'angular2/src/core/compiler/view';
import {ViewContainerRef} from 'angular2/src/core/compiler/view_container_ref';
import {AppViewManager} from 'angular2/src/core/compiler/view_manager';
export function main() {
// TODO(tbosch): add missing tests
describe('ViewContainer', () => {
describe('ViewContainerRef', () => {
var location;
var view;
var viewManager;
@ -40,7 +40,7 @@ export function main() {
}
function createViewContainer(defaultProtoView = null) {
return new ViewContainer(viewManager, location, defaultProtoView);
return new ViewContainerRef(viewManager, location, defaultProtoView);
}
beforeEach( () => {
@ -50,14 +50,14 @@ export function main() {
location = new ElementRef(null, view, 0, null, null, null);
});
it('should return a 0 length if there is no underlying ViewContainer', () => {
it('should return a 0 length if there is no underlying ViewContainerRef', () => {
var vc = createViewContainer();
expect(vc.length).toBe(0);
});
it('should return the size of the underlying ViewContainer', () => {
it('should return the size of the underlying ViewContainerRef', () => {
var vc = createViewContainer();
view.viewContainers = [new InternalAppViewContainer()];
view.viewContainers = [new AppViewContainer()];
view.viewContainers[0].views = [createView()];
expect(vc.length).toBe(1);
});

View File

@ -18,8 +18,8 @@ import {Injector, bind} from 'angular2/di';
import {IMPLEMENTS, isBlank, isPresent} from 'angular2/src/facade/lang';
import {MapWrapper, ListWrapper, StringMapWrapper} from 'angular2/src/facade/collection';
import {AppProtoView, AppView, InternalAppViewContainer} from 'angular2/src/core/compiler/view';
import {Renderer, ViewRef, ProtoViewRef, ViewContainerRef} from 'angular2/src/render/api';
import {AppProtoView, AppView, AppViewContainer} from 'angular2/src/core/compiler/view';
import {Renderer, ViewRef, ProtoViewRef, RenderViewContainerRef} from 'angular2/src/render/api';
import {ElementBinder} from 'angular2/src/core/compiler/element_binder';
import {DirectiveBinding, ElementInjector, ElementRef} from 'angular2/src/core/compiler/element_injector';
import {DirectiveMetadataReader} from 'angular2/src/core/compiler/directive_metadata_reader';
@ -122,7 +122,7 @@ export function main() {
utils.spy('attachViewInContainer').andCallFake( (parentView, elementIndex, atIndex, childView) => {
var viewContainer = parentView.viewContainers[elementIndex];
if (isBlank(viewContainer)) {
viewContainer = new InternalAppViewContainer();
viewContainer = new AppViewContainer();
parentView.viewContainers[elementIndex] = viewContainer;
}
ListWrapper.insert(viewContainer.views, atIndex, childView);
@ -385,7 +385,7 @@ export function main() {
childProtoView = createProtoView();
});
it('should create a ViewContainer if not yet existing', () => {
it('should create a ViewContainerRef if not yet existing', () => {
manager.createViewInContainer(elementRef(parentView, 0), 0, childProtoView, null);
expect(parentView.viewContainers[0]).toBeTruthy();
});
@ -411,7 +411,7 @@ export function main() {
it('should create and set the render view', () => {
manager.createViewInContainer(elementRef(parentView, 0), 0, childProtoView, null);
expect(renderer.spy('createViewInContainer')).toHaveBeenCalledWith(
new ViewContainerRef(parentView.render, 0), 0, childProtoView.render);
new RenderViewContainerRef(parentView.render, 0), 0, childProtoView.render);
expect(createdViews[0].render).toBe(createdRenderViews[0]);
});
@ -451,7 +451,7 @@ export function main() {
it('should destroy and clear the render view', () => {
manager.destroyViewInContainer(elementRef(parentView, 0), 0);
expect(renderer.spy('destroyViewInContainer')).toHaveBeenCalledWith(new ViewContainerRef(parentView.render, 0), 0);
expect(renderer.spy('destroyViewInContainer')).toHaveBeenCalledWith(new RenderViewContainerRef(parentView.render, 0), 0);
expect(childView.render).toBe(null);
});

View File

@ -15,7 +15,7 @@ import {
import {DOM} from 'angular2/src/dom/dom_adapter';
import {ProtoViewDto, ViewDefinition, ViewContainerRef, EventDispatcher, DirectiveMetadata} from 'angular2/src/render/api';
import {ProtoViewDto, ViewDefinition, RenderViewContainerRef, EventDispatcher, DirectiveMetadata} from 'angular2/src/render/api';
import {IntegrationTestbed, LoggingEventDispatcher, FakeEvent} from './integration_testbed';
@ -138,7 +138,7 @@ export function main() {
var viewRef = renderer.createInPlaceHostView(null, rootEl, rootProtoView.render)[1];
var vcProtoViewRef = rootProtoView.elementBinders[0]
.nestedProtoView.elementBinders[0].nestedProtoView.render;
var vcRef = new ViewContainerRef(viewRef, 0);
var vcRef = new RenderViewContainerRef(viewRef, 0);
expect(rootEl).toHaveText('');
var childViewRef = renderer.createViewInContainer(vcRef, 0, vcProtoViewRef)[0];
expect(rootEl).toHaveText('hello');
@ -166,7 +166,7 @@ export function main() {
var viewRef = renderer.createInPlaceHostView(null, rootEl, rootProtoView.render)[1];
var vcProtoViewRef = rootProtoView.elementBinders[0]
.nestedProtoView.elementBinders[0].nestedProtoView.render;
var vcRef = new ViewContainerRef(viewRef, 0);
var vcRef = new RenderViewContainerRef(viewRef, 0);
var viewRef1 = renderer.createViewInContainer(vcRef, 0, vcProtoViewRef)[0];
renderer.destroyViewInContainer(vcRef, 0);

View File

@ -6,7 +6,7 @@ import {DOM} from 'angular2/src/dom/dom_adapter';
import {Parser, Lexer} from 'angular2/change_detection';
import {DirectDomRenderer} from 'angular2/src/render/dom/direct_dom_renderer';
import {Compiler} from 'angular2/src/render/dom/compiler/compiler';
import {ProtoViewRef, ProtoViewDto, ViewDefinition, ViewContainerRef, EventDispatcher, DirectiveMetadata} from 'angular2/src/render/api';
import {ProtoViewRef, ProtoViewDto, ViewDefinition, RenderViewContainerRef, EventDispatcher, DirectiveMetadata} from 'angular2/src/render/api';
import {DefaultStepFactory} from 'angular2/src/render/dom/compiler/compile_step_factory';
import {TemplateLoader} from 'angular2/src/render/dom/compiler/template_loader';
import {UrlResolver} from 'angular2/src/services/url_resolver';

View File

@ -17,7 +17,7 @@ import {MapWrapper, ListWrapper, StringMapWrapper} from 'angular2/src/facade/col
import {DOM} from 'angular2/src/dom/dom_adapter';
import {
ProtoViewDto, ViewDefinition, ViewContainerRef, DirectiveMetadata
ProtoViewDto, ViewDefinition, RenderViewContainerRef, DirectiveMetadata
} from 'angular2/src/render/api';
import {EmulatedScopedShadowDomStrategy} from 'angular2/src/render/dom/shadow_dom/emulated_scoped_shadow_dom_strategy';
@ -183,7 +183,7 @@ export function main() {
});
compileRoot('main').then( (pv) => {
var viewRefs = renderer.createInPlaceHostView(null, rootEl, pv.render);
var vcRef = new ViewContainerRef(viewRefs[1], 1);
var vcRef = new RenderViewContainerRef(viewRefs[1], 1);
var vcProtoViewRef = pv.elementBinders[0].nestedProtoView
.elementBinders[1].nestedProtoView.render;
expect(rootEl).toHaveText('(, B)');
@ -213,7 +213,7 @@ export function main() {
});
compileRoot('main').then( (pv) => {
var viewRefs = renderer.createInPlaceHostView(null, rootEl, pv.render);
var vcRef = new ViewContainerRef(viewRefs[1], 1);
var vcRef = new RenderViewContainerRef(viewRefs[1], 1);
var vcProtoViewRef = pv.elementBinders[0].nestedProtoView
.elementBinders[1].nestedProtoView.render;
expect(rootEl).toHaveText('(, B)');
@ -264,7 +264,7 @@ export function main() {
});
compileRoot('main').then( (pv) => {
var viewRefs = renderer.createInPlaceHostView(null, rootEl, pv.render);
var vcRef = new ViewContainerRef(viewRefs[1], 1);
var vcRef = new RenderViewContainerRef(viewRefs[1], 1);
var vcProtoViewRef = pv.elementBinders[0].nestedProtoView
.elementBinders[1].nestedProtoView.render;
expect(rootEl).toHaveText('OUTER(INNER(INNERINNER(,BC)))');
@ -290,7 +290,7 @@ export function main() {
});
compileRoot('main').then( (pv) => {
var viewRefs = renderer.createInPlaceHostView(null, rootEl, pv.render);
var vcRef = new ViewContainerRef(viewRefs[2], 0);
var vcRef = new RenderViewContainerRef(viewRefs[2], 0);
var vcProtoViewRef = pv.elementBinders[0].nestedProtoView
.elementBinders[0].nestedProtoView
.elementBinders[0].nestedProtoView.render;
@ -323,9 +323,9 @@ export function main() {
});
compileRoot('main').then( (pv) => {
var viewRefs = renderer.createInPlaceHostView(null, rootEl, pv.render);
var vcRef0 = new ViewContainerRef(viewRefs[2], 0);
var vcRef1 = new ViewContainerRef(viewRefs[3], 0);
var vcRef2 = new ViewContainerRef(viewRefs[4], 0);
var vcRef0 = new RenderViewContainerRef(viewRefs[2], 0);
var vcRef1 = new RenderViewContainerRef(viewRefs[3], 0);
var vcRef2 = new RenderViewContainerRef(viewRefs[4], 0);
var mainPv = pv.elementBinders[0].nestedProtoView;
var pvRef = mainPv.elementBinders[0].nestedProtoView.elementBinders[0].nestedProtoView.render;

View File

@ -1,4 +1,4 @@
import {bootstrap, Component, Viewport, View, ViewContainer, Compiler, NgElement, Decorator} from 'angular2/angular2';
import {bootstrap, Component, Viewport, View, ViewContainerRef, Compiler, NgElement, Decorator} from 'angular2/angular2';
import {LifeCycle} from 'angular2/src/core/life_cycle/life_cycle';
import {reflector} from 'angular2/src/reflection/reflection';