refactor(core): rename ViewContainer to ViewContainerRef
This also renames InternalAppViewContainer into AppViewContainer Related to #1477 Closes #1554
This commit is contained in:
@ -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;
|
||||
* }
|
||||
|
@ -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;
|
||||
}
|
||||
|
6
modules/angular2/src/core/compiler/view.js
vendored
6
modules/angular2/src/core/compiler/view.js
vendored
@ -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;
|
||||
|
@ -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;
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user