chore(core): remove @View annotation

Closes #7495
This commit is contained in:
Brian Ford
2016-03-08 13:36:48 -08:00
parent 095db673c5
commit f9fb72fb0e
85 changed files with 588 additions and 599 deletions

View File

@ -9,7 +9,6 @@ import {
Compiler,
Component,
Directive,
View,
ViewContainerRef,
bind,
provide,
@ -91,8 +90,7 @@ class MultiplyViewResolver extends ViewResolver {
}
}
@Component({selector: 'app'})
@View({directives: [], template: ``})
@Component({selector: 'app', directives: [], template: ``})
class CompilerAppComponent {
constructor(private _compiler: Compiler) {}
compileNoBindings() {
@ -131,8 +129,8 @@ class Dir4 {
}
@Component({selector: 'cmp-nobind'})
@View({
@Component({
selector: 'cmp-nobind',
directives: [Dir0, Dir1, Dir2, Dir3, Dir4],
template: `
<div class="class0 class1 class2 class3 class4 " nodir0="" attr0="value0" nodir1="" attr1="value1" nodir2="" attr2="value2" nodir3="" attr3="value3" nodir4="" attr4="value4">
@ -149,8 +147,8 @@ class Dir4 {
class BenchmarkComponentNoBindings {
}
@Component({selector: 'cmp-withbind'})
@View({
@Component({
selector: 'cmp-withbind',
directives: [Dir0, Dir1, Dir2, Dir3, Dir4],
template: `
<div class="class0 class1 class2 class3 class4 " dir0="" [attr0]="value0" dir1="" [attr1]="value1" dir2="" [attr2]="value2" dir3="" [attr3]="value3" dir4="" [attr4]="value4">

View File

@ -1,5 +1,5 @@
import {bootstrap} from 'angular2/bootstrap';
import {Component, Directive, DynamicComponentLoader, ElementRef, View} from 'angular2/core';
import {Component, Directive, DynamicComponentLoader, ElementRef} from 'angular2/core';
import {NgIf, NgFor} from 'angular2/common';
import {ApplicationRef} from 'angular2/src/core/application_ref';
import {ListWrapper} from 'angular2/src/facade/collection';
@ -43,8 +43,7 @@ export function main() {
}
@Component({selector: 'dummy'})
@View({template: `<div></div>`})
@Component({selector: 'dummy', template: `<div></div>`})
class DummyComponent {
}
@ -59,8 +58,8 @@ class DynamicDummy {
}
}
@Component({selector: 'app'})
@View({
@Component({
selector: 'app',
directives: [NgIf, NgFor, DummyComponent, DummyDirective, DynamicDummy],
template: `
<div *ngIf="testingPlainComponents">

View File

@ -8,7 +8,7 @@ import {
windowProfileEnd
} from 'angular2/src/testing/benchmark_util';
import {bootstrap} from 'angular2/bootstrap';
import {Component, Directive, View, bind, provide} from 'angular2/core';
import {Component, Directive, bind, provide} from 'angular2/core';
import {NgFor, NgSwitch, NgSwitchWhen, NgSwitchDefault} from 'angular2/common';
import {ApplicationRef} from 'angular2/src/core/application_ref';
import {BrowserDomAdapter} from 'angular2/src/platform/browser/browser_adapter';
@ -207,8 +207,9 @@ class CellData {
iFn() { return this.i; }
}
@Component({selector: 'largetable', inputs: ['data', 'benchmarkType']})
@View({
@Component({
selector: 'largetable',
inputs: ['data', 'benchmarkType'],
directives: [NgFor, NgSwitch, NgSwitchWhen, NgSwitchDefault],
template: `
<table [ngSwitch]="benchmarkType">
@ -255,8 +256,8 @@ class LargetableComponent {
}
}
@Component({selector: 'app'})
@View({
@Component({
selector: 'app',
directives: [LargetableComponent],
template: `<largetable [data]='data' [benchmarkType]='benchmarkType'></largetable>`
})

View File

@ -6,11 +6,11 @@ import {NgIf, NgFor} from 'angular2/common';
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
import {document} from 'angular2/src/facade/browser';
import {Component, Directive, View} from 'angular2/core';
import {Component, Directive} from 'angular2/core';
@Component({selector: 'scroll-app'})
@View({
@Component({
selector: 'scroll-app',
directives: [ScrollAreaComponent, NgIf, NgFor],
template: `
<div>

View File

@ -2,7 +2,7 @@ import {ListWrapper, Map} from 'angular2/src/facade/collection';
import {Company, Opportunity, Offering, Account, CustomDate, STATUS_LIST} from './common';
import {NgFor} from 'angular2/common';
import {Component, Directive, View} from 'angular2/core';
import {Component, Directive} from 'angular2/core';
export class HasStyle {
cellWidth: number;
@ -12,20 +12,32 @@ export class HasStyle {
set width(w: number) { this.cellWidth = w; }
}
@Component({selector: 'company-name', inputs: ['width: cell-width', 'company']})
@View({directives: [], template: `<div [style.width.px]="cellWidth">{{company.name}}</div>`})
@Component({
selector: 'company-name',
inputs: ['width: cell-width', 'company'],
directives: [],
template: `<div [style.width.px]="cellWidth">{{company.name}}</div>`
})
export class CompanyNameComponent extends HasStyle {
company: Company;
}
@Component({selector: 'opportunity-name', inputs: ['width: cell-width', 'opportunity']})
@View({directives: [], template: `<div [style.width.px]="cellWidth">{{opportunity.name}}</div>`})
@Component({
selector: 'opportunity-name',
inputs: ['width: cell-width', 'opportunity'],
directives: [],
template: `<div [style.width.px]="cellWidth">{{opportunity.name}}</div>`
})
export class OpportunityNameComponent extends HasStyle {
opportunity: Opportunity;
}
@Component({selector: 'offering-name', inputs: ['width: cell-width', 'offering']})
@View({directives: [], template: `<div [style.width.px]="cellWidth">{{offering.name}}</div>`})
@Component({
selector: 'offering-name',
inputs: ['width: cell-width', 'offering'],
directives: [],
template: `<div [style.width.px]="cellWidth">{{offering.name}}</div>`
})
export class OfferingNameComponent extends HasStyle {
offering: Offering;
}
@ -37,8 +49,9 @@ export class Stage {
apply: Function;
}
@Component({selector: 'stage-buttons', inputs: ['width: cell-width', 'offering']})
@View({
@Component({
selector: 'stage-buttons',
inputs: ['width: cell-width', 'offering'],
directives: [NgFor],
template: `
<div [style.width.px]="cellWidth">
@ -82,8 +95,9 @@ export class StageButtonsComponent extends HasStyle {
}
}
@Component({selector: 'account-cell', inputs: ['width: cell-width', 'account']})
@View({
@Component({
selector: 'account-cell',
inputs: ['width: cell-width', 'account'],
directives: [],
template: `
<div [style.width.px]="cellWidth">
@ -96,8 +110,12 @@ export class AccountCellComponent extends HasStyle {
account: Account;
}
@Component({selector: 'formatted-cell', inputs: ['width: cell-width', 'value']})
@View({directives: [], template: `<div [style.width.px]="cellWidth">{{formattedValue}}</div>`})
@Component({
selector: 'formatted-cell',
inputs: ['width: cell-width', 'value'],
directives: [],
template: `<div [style.width.px]="cellWidth">{{formattedValue}}</div>`
})
export class FormattedCellComponent extends HasStyle {
formattedValue: string;

View File

@ -1,7 +1,7 @@
import {ListWrapper} from 'angular2/src/facade/collection';
import {Math} from 'angular2/src/facade/math';
import {Component, Directive, View} from 'angular2/core';
import {Component, Directive} from 'angular2/core';
import {
Offering,
@ -18,8 +18,6 @@ import {NgFor} from 'angular2/common';
@Component({
selector: 'scroll-area',
})
@View({
directives: [ScrollItemComponent, NgFor],
template: `
<div>

View File

@ -7,7 +7,7 @@ import {
FormattedCellComponent
} from './cells';
import {Component, Directive, View} from 'angular2/core';
import {Component, Directive} from 'angular2/core';
import {
Offering,
@ -25,8 +25,9 @@ import {
AAT_STATUS_WIDTH
} from './common';
@Component({selector: 'scroll-item', inputs: ['offering']})
@View({
@Component({
selector: 'scroll-item',
inputs: ['offering'],
directives: [
CompanyNameComponent,
OpportunityNameComponent,

View File

@ -4,7 +4,6 @@ import {
Compiler,
Component,
Directive,
View,
ViewContainerRef,
bind,
provide,
@ -225,21 +224,23 @@ class StaticTreeComponentBase {
get data() { return this._value; }
}
@Component({selector: 'tree', inputs: ['data']})
@View({directives: [], template: '<span>{{data.value}} </span>'})
@Component(
{selector: 'tree', inputs: ['data'], directives: [], template: '<span>{{data.value}} </span>'})
class StaticTreeComponent0 extends StaticTreeComponentBase {
}
@Component({selector: 'tree', inputs: ['data']})
@View({
@Component({
selector: 'tree',
inputs: ['data'],
directives: [StaticTreeComponent0],
template: `<span> {{data.value}} <tree [data]='data.right'></tree><tree [data]='data.left'></tree></span>`
})
class StaticTreeComponent1 extends StaticTreeComponentBase {
}
@Component({selector: 'tree', inputs: ['data']})
@View({
@Component({
selector: 'tree',
inputs: ['data'],
directives: [StaticTreeComponent1],
template: `<span> {{data.value}} <tree [data]='data.right'></tree><tree [data]='data.left'></tree></span>`
})
@ -247,64 +248,71 @@ class StaticTreeComponent2 extends StaticTreeComponentBase {
data: TreeNode;
}
@Component({selector: 'tree', inputs: ['data']})
@View({
@Component({
selector: 'tree',
inputs: ['data'],
directives: [StaticTreeComponent2],
template: `<span> {{data.value}} <tree [data]='data.right'></tree><tree [data]='data.left'></tree></span>`
})
class StaticTreeComponent3 extends StaticTreeComponentBase {
}
@Component({selector: 'tree', inputs: ['data']})
@View({
@Component({
selector: 'tree',
inputs: ['data'],
directives: [StaticTreeComponent3],
template: `<span> {{data.value}} <tree [data]='data.right'></tree><tree [data]='data.left'></tree></span>`
})
class StaticTreeComponent4 extends StaticTreeComponentBase {
}
@Component({selector: 'tree', inputs: ['data']})
@View({
@Component({
selector: 'tree',
inputs: ['data'],
directives: [StaticTreeComponent4],
template: `<span> {{data.value}} <tree [data]='data.right'></tree><tree [data]='data.left'></tree></span>`
})
class StaticTreeComponent5 extends StaticTreeComponentBase {
}
@Component({selector: 'tree', inputs: ['data']})
@View({
@Component({
selector: 'tree',
inputs: ['data'],
directives: [StaticTreeComponent5],
template: `<span> {{data.value}} <tree [data]='data.right'></tree><tree [data]='data.left'></tree></span>`
})
class StaticTreeComponent6 extends StaticTreeComponentBase {
}
@Component({selector: 'tree', inputs: ['data']})
@View({
@Component({
selector: 'tree',
inputs: ['data'],
directives: [StaticTreeComponent6],
template: `<span> {{data.value}} <tree [data]='data.right'></tree><tree [data]='data.left'></tree></span>`
})
class StaticTreeComponent7 extends StaticTreeComponentBase {
}
@Component({selector: 'tree', inputs: ['data']})
@View({
@Component({
selector: 'tree',
inputs: ['data'],
directives: [StaticTreeComponent7],
template: `<span> {{data.value}} <tree [data]='data.right'></tree><tree [data]='data.left'></tree></span>`
})
class StaticTreeComponent8 extends StaticTreeComponentBase {
}
@Component({selector: 'tree', inputs: ['data']})
@View({
@Component({
selector: 'tree',
inputs: ['data'],
directives: [StaticTreeComponent8],
template: `<span> {{data.value}} <tree [data]='data.right'></tree><tree [data]='data.left'></tree></span>`
})
class StaticTreeComponent9 extends StaticTreeComponentBase {
}
@Component({selector: 'app'})
@View({
@Component({
selector: 'app',
directives: [StaticTreeComponent9, NgIf],
template: `<tree *ngIf="initData != null" [data]='initData'></tree>`
})

View File

@ -3,7 +3,6 @@ import {
Compiler,
Component,
Directive,
View,
ViewContainerRef,
bind,
provide,
@ -217,8 +216,9 @@ class BaseLineIf {
}
}
@Component({selector: 'tree', inputs: ['data']})
@View({
@Component({
selector: 'tree',
inputs: ['data'],
directives: [TreeComponent, NgIf],
template:
`<span> {{data.value}} <span template='ngIf data.right != null'><tree [data]='data.right'></tree></span><span template='ngIf data.left != null'><tree [data]='data.left'></tree></span></span>`
@ -227,8 +227,8 @@ class TreeComponent {
data: TreeNode;
}
@Component({selector: 'app'})
@View({directives: [TreeComponent], template: `<tree [data]='initData'></tree>`})
@Component(
{selector: 'app', directives: [TreeComponent], template: `<tree [data]='initData'></tree>`})
class AppComponent {
initData: TreeNode;
constructor() {