refactor(ViewPort): @Template -> @Viewport, ViewPort -> ViewContainer
fixes #595
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import {int, isPresent} from 'angular2/src/facade/lang';
|
||||
import {reflector} from 'angular2/src/reflection/reflection';
|
||||
import {getIntParameter, bindAction} from 'angular2/src/test_lib/benchmark_util';
|
||||
import {bootstrap, Component, Template, TemplateConfig, ViewPort, Compiler}
|
||||
import {bootstrap, Component, Viewport, TemplateConfig, ViewContainer, Compiler}
|
||||
from 'angular2/angular2';
|
||||
import {PromiseWrapper} from 'angular2/src/facade/async';
|
||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
||||
|
@ -1,7 +1,7 @@
|
||||
import {int} from 'angular2/src/facade/lang';
|
||||
import {reflector} from 'angular2/src/reflection/reflection';
|
||||
import {getIntParameter, bindAction} from 'angular2/src/test_lib/benchmark_util';
|
||||
import {bootstrap, Component, Template, TemplateConfig, ViewPort, Compiler}
|
||||
import {bootstrap, Component, Viewport, TemplateConfig, ViewContainer, Compiler}
|
||||
from 'angular2/angular2';
|
||||
import {PromiseWrapper} from 'angular2/src/facade/async';
|
||||
import {ListWrapper, MapWrapper} from 'angular2/src/facade/collection';
|
||||
|
@ -4,7 +4,7 @@ import {MapWrapper} from 'angular2/src/facade/collection';
|
||||
|
||||
import {Parser, Lexer, ChangeDetector, ChangeDetection}
|
||||
from 'angular2/change_detection';
|
||||
import {bootstrap, Component, Template, TemplateConfig, ViewPort, Compiler}
|
||||
import {bootstrap, Component, Viewport, TemplateConfig, ViewContainer, Compiler}
|
||||
from 'angular2/angular2';
|
||||
import {reflector} from 'angular2/src/reflection/reflection';
|
||||
import {CompilerCache} from 'angular2/src/core/compiler/compiler';
|
||||
@ -151,8 +151,8 @@ export function setupReflector() {
|
||||
export function setupReflectorForAngular() {
|
||||
reflector.registerType(If, {
|
||||
'factory': (vp) => new If(vp),
|
||||
'parameters': [[ViewPort]],
|
||||
'annotations' : [new Template({
|
||||
'parameters': [[ViewContainer]],
|
||||
'annotations' : [new Viewport({
|
||||
selector: '[if]',
|
||||
bind: {
|
||||
'if': 'condition'
|
||||
@ -162,8 +162,8 @@ export function setupReflectorForAngular() {
|
||||
|
||||
reflector.registerType(Foreach, {
|
||||
'factory': (vp) => new Foreach(vp),
|
||||
'parameters': [[ViewPort]],
|
||||
'annotations' : [new Template({
|
||||
'parameters': [[ViewContainer]],
|
||||
'annotations' : [new Viewport({
|
||||
selector: '[foreach]',
|
||||
bind: {
|
||||
'in': 'iterable[]'
|
||||
|
@ -1,7 +1,7 @@
|
||||
import {int, FINAL} from 'angular2/src/facade/lang';
|
||||
import {reflector} from 'angular2/src/reflection/reflection';
|
||||
import {getIntParameter, bindAction} from 'angular2/src/test_lib/benchmark_util';
|
||||
import {Component, Template, TemplateConfig, ViewPort, Compiler}
|
||||
import {Component, Viewport, TemplateConfig, ViewContainer, Compiler}
|
||||
from 'angular2/angular2';
|
||||
import {PromiseWrapper} from 'angular2/src/facade/async';
|
||||
import {ListWrapper, MapWrapper} from 'angular2/src/facade/collection';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {int} from 'angular2/src/facade/lang';
|
||||
import {reflector} from 'angular2/src/reflection/reflection';
|
||||
import {Component, Template, TemplateConfig, ViewPort, Compiler}
|
||||
import {Component, Viewport, TemplateConfig, ViewContainer, Compiler}
|
||||
from 'angular2/angular2';
|
||||
import {PromiseWrapper} from 'angular2/src/facade/async';
|
||||
import {ListWrapper, MapWrapper} from 'angular2/src/facade/collection';
|
||||
|
@ -1,7 +1,7 @@
|
||||
import {Parser, Lexer, ChangeDetector, ChangeDetection, jitChangeDetection}
|
||||
from 'angular2/change_detection';
|
||||
|
||||
import {bootstrap, Component, Template, TemplateConfig, ViewPort, Compiler} from 'angular2/angular2';
|
||||
import {bootstrap, Component, Viewport, TemplateConfig, ViewContainer, Compiler} from 'angular2/angular2';
|
||||
|
||||
import {CompilerCache} from 'angular2/src/core/compiler/compiler';
|
||||
import {DirectiveMetadataReader} from 'angular2/src/core/compiler/directive_metadata_reader';
|
||||
@ -50,8 +50,8 @@ function setupReflector() {
|
||||
|
||||
reflector.registerType(NgIf, {
|
||||
'factory': (vp) => new NgIf(vp),
|
||||
'parameters': [[ViewPort]],
|
||||
'annotations' : [new Template({
|
||||
'parameters': [[ViewContainer]],
|
||||
'annotations' : [new Viewport({
|
||||
selector: '[ng-if]',
|
||||
bind: {
|
||||
'ng-if': 'ngIf'
|
||||
@ -335,16 +335,16 @@ class AppComponent {
|
||||
|
||||
// TODO: Move this into a reusable directive in the 'core' module!
|
||||
class NgIf {
|
||||
_viewPort:ViewPort;
|
||||
constructor(viewPort:ViewPort) {
|
||||
this._viewPort = viewPort;
|
||||
_viewContainer:ViewContainer;
|
||||
constructor(viewContainer:ViewContainer) {
|
||||
this._viewContainer = viewContainer;
|
||||
}
|
||||
set ngIf(value:boolean) {
|
||||
if (this._viewPort.length > 0) {
|
||||
this._viewPort.remove(0);
|
||||
if (this._viewContainer.length > 0) {
|
||||
this._viewContainer.remove(0);
|
||||
}
|
||||
if (value) {
|
||||
this._viewPort.create();
|
||||
this._viewContainer.create();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user