diff --git a/TOOLS_JS.md b/TOOLS_JS.md
index 0f7aeffa61..3ab46a6201 100644
--- a/TOOLS_JS.md
+++ b/TOOLS_JS.md
@@ -117,7 +117,7 @@ speed things up is to use plain class fields in your expressions and avoid any
kinds of computation. Example:
```typescript
-@View({
+@Component({
template: ''
})
class FancyButton {
diff --git a/modules/angular2/docs/core/02_directives.md b/modules/angular2/docs/core/02_directives.md
index 1f95e0e44b..7200ed6e05 100644
--- a/modules/angular2/docs/core/02_directives.md
+++ b/modules/angular2/docs/core/02_directives.md
@@ -112,9 +112,7 @@ Example of a component:
'title', | - title mapped to component title
'open' | - open attribute mapped to component's open property
], |
-}) |
-@View({ | View annotation
- templateUrl: 'pane.html' | - URL of template HTML
+ templateUrl: 'pane.html' | URL of template HTML
}) |
class Pane { | Component controller class
title:string; | - title property
@@ -227,11 +225,9 @@ class MyService {} | Assume a service which needs to be inject
|
@Component({ | Assume a top level application component which
selector: 'my-app', | configures the services to be injected.
- viewBindings: [MyService] |
-}) |
-@View({ | Assume we have a template that needs to be
- templateUrl: 'my_app.html', | configured with directives to be injected.
- directives: [House] |
+ viewBindings: [MyService], |
+ templateUrl: 'my_app.html', | Assume we have a template that needs to be
+ directives: [House] | configured with directives to be injected.
}) |
class MyApp {} |
|
@@ -273,8 +269,6 @@ Here is an example of the kinds of injections which can be achieved:
```
@Component({ |
selector: 'my-app' |
-}) |
-@View({ |
templateUrl: 'my_app.html', |
directives: [Form, FieldSet, |
Field, Primary] |
@@ -329,8 +323,6 @@ Shadow DOM provides an encapsulation for components, so as a general rule it doe
```
@Component({
selector: '[kid]'
-})
-@View({
templateUrl: 'kid.html',
directives: []
})
@@ -347,8 +339,6 @@ class Kid {
@Component({
selector: '[dad]'
-})
-@View({
templateUrl: 'dad.html',
directives: [Kid]
})
@@ -361,9 +351,7 @@ class Dad {
@Component({
selector: '[grandpa]',
- viewBindings: []
-})
-@View({
+ viewBindings: [],
templateUrl: 'grandpa.html',
directives: [Dad]
})
diff --git a/modules/angular2/docs/di/di_advanced.md b/modules/angular2/docs/di/di_advanced.md
index 2892603d41..caa64164ac 100644
--- a/modules/angular2/docs/di/di_advanced.md
+++ b/modules/angular2/docs/di/di_advanced.md
@@ -179,9 +179,7 @@ Both `MyComponent` and `MyDirective` are created on the same element.
],
viewBindings: [
bind('viewService').toValue('View_MyComponentService')
- ]
-})
-@View({
+ ],
template: ``,
directives: [NeedsViewService]
})
diff --git a/modules/angular2/src/common/common_directives.ts b/modules/angular2/src/common/common_directives.ts
index 089395fe2a..50c3a6c2e6 100644
--- a/modules/angular2/src/common/common_directives.ts
+++ b/modules/angular2/src/common/common_directives.ts
@@ -9,7 +9,7 @@ import {CORE_DIRECTIVES} from './directives';
* NgModel).
*
* This collection can be used to quickly enumerate all the built-in directives in the `directives`
- * property of the `@Component` or `@View` decorators.
+ * property of the `@Component` decorator.
*
* ### Example
*
diff --git a/modules/angular2/src/common/directives/core_directives.ts b/modules/angular2/src/common/directives/core_directives.ts
index e9dbd2464c..64772e101a 100644
--- a/modules/angular2/src/common/directives/core_directives.ts
+++ b/modules/angular2/src/common/directives/core_directives.ts
@@ -11,7 +11,7 @@ import {NgPlural, NgPluralCase} from './ng_plural';
* application.
*
* This collection can be used to quickly enumerate all the built-in directives in the `directives`
- * property of the `@View` annotation.
+ * property of the `@Component` annotation.
*
* ### Example ([live demo](http://plnkr.co/edit/yakGwpCdUkg0qfzX5m8g?p=preview))
*
diff --git a/modules/angular2/src/common/directives/ng_switch.ts b/modules/angular2/src/common/directives/ng_switch.ts
index 658d03c1d7..6b46d4bff3 100644
--- a/modules/angular2/src/common/directives/ng_switch.ts
+++ b/modules/angular2/src/common/directives/ng_switch.ts
@@ -32,8 +32,8 @@ export class SwitchView {
* ### Example ([live demo](http://plnkr.co/edit/DQMTII95CbuqWrl3lYAs?p=preview))
*
* ```typescript
- * @Component({selector: 'app'})
- * @View({
+ * @Component({
+ * selector: 'app',
* template: `
*
Value = {{value}}
*
diff --git a/modules/angular2/src/common/forms/directives.ts b/modules/angular2/src/common/forms/directives.ts
index 7024aa3b80..5becfaa109 100644
--- a/modules/angular2/src/common/forms/directives.ts
+++ b/modules/angular2/src/common/forms/directives.ts
@@ -50,7 +50,7 @@ export {ControlValueAccessor} from './directives/control_value_accessor';
/**
*
- * A list of all the form directives used as part of a `@View` annotation.
+ * A list of all the form directives used as part of a `@Component` annotation.
*
* This is a shorthand for importing them each individually.
*
diff --git a/modules/angular2/src/common/forms/directives/ng_control_group.ts b/modules/angular2/src/common/forms/directives/ng_control_group.ts
index 31987a16de..208c401153 100644
--- a/modules/angular2/src/common/forms/directives/ng_control_group.ts
+++ b/modules/angular2/src/common/forms/directives/ng_control_group.ts
@@ -33,8 +33,6 @@ const controlGroupProvider =
* @Component({
* selector: 'my-app',
* directives: [FORM_DIRECTIVES],
- * })
- * @View({
* template: `
*
*
Angular2 Control & ControlGroup Example
diff --git a/modules/angular2/src/common/pipes/common_pipes.ts b/modules/angular2/src/common/pipes/common_pipes.ts
index 810b1e0eb4..cc92c09f20 100644
--- a/modules/angular2/src/common/pipes/common_pipes.ts
+++ b/modules/angular2/src/common/pipes/common_pipes.ts
@@ -20,7 +20,7 @@ import {CONST_EXPR} from 'angular2/src/facade/lang';
* application.
*
* This collection can be used to quickly enumerate all the built-in pipes in the `pipes`
- * property of the `@Component` or `@View` decorators.
+ * property of the `@Component` decorator.
*/
export const COMMON_PIPES = CONST_EXPR([
AsyncPipe,
diff --git a/modules/angular2/src/core/linker/view_resolver.ts b/modules/angular2/src/core/linker/view_resolver.ts
index 35d90d5d3e..8eb82cac03 100644
--- a/modules/angular2/src/core/linker/view_resolver.ts
+++ b/modules/angular2/src/core/linker/view_resolver.ts
@@ -45,7 +45,7 @@ export class ViewResolver {
if (isPresent(compMeta)) {
if (isBlank(compMeta.template) && isBlank(compMeta.templateUrl) && isBlank(viewMeta)) {
throw new BaseException(
- `Component '${stringify(component)}' must have either 'template', 'templateUrl', or '@View' set.`);
+ `Component '${stringify(component)}' must have either 'template' or 'templateUrl' set.`);
} else if (isPresent(compMeta.template) && isPresent(viewMeta)) {
this._throwMixingViewAndComponent("template", component);
@@ -84,7 +84,8 @@ export class ViewResolver {
}
} else {
if (isBlank(viewMeta)) {
- throw new BaseException(`No View decorator found on component '${stringify(component)}'`);
+ throw new BaseException(
+ `Could not compile '${stringify(component)}' because it is not a component.`);
} else {
return viewMeta;
}
diff --git a/modules/angular2/src/core/metadata.ts b/modules/angular2/src/core/metadata.ts
index 67998bef77..b938e47add 100644
--- a/modules/angular2/src/core/metadata.ts
+++ b/modules/angular2/src/core/metadata.ts
@@ -254,7 +254,6 @@ export interface ComponentFactory {
* import {Component, View} from "angular2/core";
*
* @Component({...})
- * @View({...})
* class MyComponent {
* constructor() {
* ...
@@ -481,8 +480,7 @@ export interface HostListenerFactory {
/**
* Declare reusable UI building blocks for an application.
*
- * Each Angular component requires a single `@Component` and at least one `@View` annotation. The
- * `@Component`
+ * Each Angular component requires a single `@Component` annotation. The `@Component`
* annotation specifies when a component is instantiated, and which properties and hostListeners it
* binds to.
*
@@ -493,8 +491,6 @@ export interface HostListenerFactory {
*
* All template expressions and statements are then evaluated against the component instance.
*
- * For details on the `@View` annotation, see {@link ViewMetadata}.
- *
* ## Lifecycle hooks
*
* When the component class implements some {@link angular2/lifecycle_hooks} the callbacks are
@@ -918,8 +914,7 @@ export var Directive: DirectiveFactory = makeDecorator(Directi
* }
* ```
*/
-export var View: ViewFactory =
- makeDecorator(ViewMetadata, (fn: any) => fn.View = View);
+var View: ViewFactory = makeDecorator(ViewMetadata, (fn: any) => fn.View = View);
/**
* Specifies that a constant attribute value should be injected.
@@ -1154,8 +1149,8 @@ export var ViewChild: ViewChildFactory = makePropDecorator(ViewChildMetadata);
* ### Example ([live demo](http://plnkr.co/edit/eNsFHDf7YjyM6IzKxM1j?p=preview))
*
* ```javascript
- * @Component({...})
- * @View({
+ * @Component({
+ * ...,
* template: `
* a
* b
diff --git a/modules/angular2/src/core/metadata/di.ts b/modules/angular2/src/core/metadata/di.ts
index b9d1389766..c5be6fce20 100644
--- a/modules/angular2/src/core/metadata/di.ts
+++ b/modules/angular2/src/core/metadata/di.ts
@@ -242,8 +242,8 @@ export class ContentChildMetadata extends QueryMetadata {
* ### Example ([live demo](http://plnkr.co/edit/eNsFHDf7YjyM6IzKxM1j?p=preview))
*
* ```javascript
- * @Component({...})
- * @View({
+ * @Component({
+ * ...,
* template: `
* a
* b
diff --git a/modules/angular2/src/router/instruction.ts b/modules/angular2/src/router/instruction.ts
index bf55a8f3ab..86f900da51 100644
--- a/modules/angular2/src/router/instruction.ts
+++ b/modules/angular2/src/router/instruction.ts
@@ -59,8 +59,10 @@ export class RouteParams {
* ])
* class AppCmp {}
*
- * @Component({...})
- * @View({ template: 'user: {{isAdmin}}' })
+ * @Component({
+ * ...,
+ * template: 'user: {{isAdmin}}'
+ * })
* class UserCmp {
* string: isAdmin;
* constructor(data: RouteData) {
diff --git a/modules/angular2/test/common/directives/ng_class_spec.ts b/modules/angular2/test/common/directives/ng_class_spec.ts
index eaab56b63b..2330f2a0a3 100644
--- a/modules/angular2/test/common/directives/ng_class_spec.ts
+++ b/modules/angular2/test/common/directives/ng_class_spec.ts
@@ -15,7 +15,7 @@ import {
xit,
} from 'angular2/testing_internal';
import {ListWrapper, StringMapWrapper, SetWrapper} from 'angular2/src/facade/collection';
-import {Component, View, provide} from 'angular2/core';
+import {Component, provide} from 'angular2/core';
import {NgFor} from 'angular2/common';
import {NgClass} from 'angular2/src/common/directives/ng_class';
@@ -528,8 +528,7 @@ export function main() {
})
}
-@Component({selector: 'test-cmp'})
-@View({directives: [NgClass, NgFor]})
+@Component({selector: 'test-cmp', directives: [NgClass, NgFor], template: ''})
class TestComponent {
condition: boolean = true;
items: any[];
diff --git a/modules/angular2/test/common/directives/ng_for_spec.ts b/modules/angular2/test/common/directives/ng_for_spec.ts
index 487afd6eeb..dd8efbe40f 100644
--- a/modules/angular2/test/common/directives/ng_for_spec.ts
+++ b/modules/angular2/test/common/directives/ng_for_spec.ts
@@ -14,7 +14,7 @@ import {
} from 'angular2/testing_internal';
import {ListWrapper} from 'angular2/src/facade/collection';
-import {Component, View, TemplateRef, ContentChild} from 'angular2/core';
+import {Component, TemplateRef, ContentChild} from 'angular2/core';
import {NgFor} from 'angular2/src/common/directives/ng_for';
import {NgIf} from 'angular2/src/common/directives/ng_if';
import {By} from 'angular2/platform/common_dom';
@@ -472,8 +472,7 @@ class Foo {
toString() { return 'foo'; }
}
-@Component({selector: 'test-cmp'})
-@View({directives: [NgFor, NgIf]})
+@Component({selector: 'test-cmp', directives: [NgFor, NgIf], template: ''})
class TestComponent {
@ContentChild(TemplateRef) contentTpl: TemplateRef;
items: any;
@@ -482,8 +481,7 @@ class TestComponent {
trackByIndex(index: number, item: any): number { return index; }
}
-@Component({selector: 'outer-cmp'})
-@View({directives: [TestComponent]})
+@Component({selector: 'outer-cmp', directives: [TestComponent], template: ''})
class ComponentUsingTestComponent {
items: any;
constructor() { this.items = [1, 2]; }
diff --git a/modules/angular2/test/common/directives/ng_if_spec.ts b/modules/angular2/test/common/directives/ng_if_spec.ts
index ed0afda6a5..921855dc5a 100644
--- a/modules/angular2/test/common/directives/ng_if_spec.ts
+++ b/modules/angular2/test/common/directives/ng_if_spec.ts
@@ -14,7 +14,7 @@ import {
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
-import {Component, View} from 'angular2/core';
+import {Component} from 'angular2/core';
import {NgIf} from 'angular2/common';
import {IS_DART} from 'angular2/src/facade/lang';
@@ -224,8 +224,7 @@ export function main() {
});
}
-@Component({selector: 'test-cmp'})
-@View({directives: [NgIf]})
+@Component({selector: 'test-cmp', directives: [NgIf], template: ''})
class TestComponent {
booleanCondition: boolean;
nestedBooleanCondition: boolean;
diff --git a/modules/angular2/test/common/directives/ng_plural_spec.ts b/modules/angular2/test/common/directives/ng_plural_spec.ts
index 0253696e4c..e89d085b35 100644
--- a/modules/angular2/test/common/directives/ng_plural_spec.ts
+++ b/modules/angular2/test/common/directives/ng_plural_spec.ts
@@ -13,7 +13,7 @@ import {
xit,
} from 'angular2/testing_internal';
-import {Component, View, Injectable, provide} from 'angular2/core';
+import {Component, Injectable, provide} from 'angular2/core';
import {NgPlural, NgPluralCase, NgLocalization} from 'angular2/common';
export function main() {
@@ -128,8 +128,7 @@ export class TestLocalizationMap extends NgLocalization {
}
-@Component({selector: 'test-cmp'})
-@View({directives: [NgPlural, NgPluralCase]})
+@Component({selector: 'test-cmp', directives: [NgPlural, NgPluralCase], template: ''})
class TestComponent {
switchValue: number;
diff --git a/modules/angular2/test/common/directives/ng_style_spec.ts b/modules/angular2/test/common/directives/ng_style_spec.ts
index 764783f793..4b816b05fc 100644
--- a/modules/angular2/test/common/directives/ng_style_spec.ts
+++ b/modules/angular2/test/common/directives/ng_style_spec.ts
@@ -16,7 +16,7 @@ import {
import {StringMapWrapper} from 'angular2/src/facade/collection';
-import {Component, View} from 'angular2/core';
+import {Component} from 'angular2/core';
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
import {NgStyle} from 'angular2/src/common/directives/ng_style';
@@ -137,8 +137,7 @@ export function main() {
})
}
-@Component({selector: 'test-cmp'})
-@View({directives: [NgStyle]})
+@Component({selector: 'test-cmp', directives: [NgStyle], template: ''})
class TestComponent {
expr;
}
diff --git a/modules/angular2/test/common/directives/ng_switch_spec.ts b/modules/angular2/test/common/directives/ng_switch_spec.ts
index 6e58c68364..030c17ca70 100644
--- a/modules/angular2/test/common/directives/ng_switch_spec.ts
+++ b/modules/angular2/test/common/directives/ng_switch_spec.ts
@@ -12,7 +12,7 @@ import {
xit,
} from 'angular2/testing_internal';
-import {Component, View} from 'angular2/core';
+import {Component} from 'angular2/core';
import {NgSwitch, NgSwitchWhen, NgSwitchDefault} from 'angular2/src/common/directives/ng_switch';
@@ -145,8 +145,8 @@ export function main() {
});
}
-@Component({selector: 'test-cmp'})
-@View({directives: [NgSwitch, NgSwitchWhen, NgSwitchDefault]})
+@Component(
+ {selector: 'test-cmp', directives: [NgSwitch, NgSwitchWhen, NgSwitchDefault], template: ''})
class TestComponent {
switchValue: any;
when1: any;
diff --git a/modules/angular2/test/common/directives/non_bindable_spec.ts b/modules/angular2/test/common/directives/non_bindable_spec.ts
index 0443847ea5..74926f2f2b 100644
--- a/modules/angular2/test/common/directives/non_bindable_spec.ts
+++ b/modules/angular2/test/common/directives/non_bindable_spec.ts
@@ -12,7 +12,7 @@ import {
xit,
} from 'angular2/testing_internal';
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
-import {Component, Directive, View} from 'angular2/core';
+import {Component, Directive} from 'angular2/core';
import {ElementRef} from 'angular2/src/core/linker/element_ref';
export function main() {
@@ -65,8 +65,7 @@ class TestDirective {
constructor(el: ElementRef) { DOM.addClass(el.nativeElement, 'compiled'); }
}
-@Component({selector: 'test-cmp'})
-@View({directives: [TestDirective]})
+@Component({selector: 'test-cmp', directives: [TestDirective], template: ''})
class TestComponent {
text: string;
constructor() { this.text = 'foo'; }
diff --git a/modules/angular2/test/common/forms/integration_spec.ts b/modules/angular2/test/common/forms/integration_spec.ts
index 6907e63391..2b84114bd5 100644
--- a/modules/angular2/test/common/forms/integration_spec.ts
+++ b/modules/angular2/test/common/forms/integration_spec.ts
@@ -1,4 +1,4 @@
-import {Component, Directive, View, Output, EventEmitter} from 'angular2/core';
+import {Component, Directive, Output, EventEmitter} from 'angular2/core';
import {
ComponentFixture,
afterEach,
diff --git a/modules/angular2/test/compiler/runtime_compiler_spec.ts b/modules/angular2/test/compiler/runtime_compiler_spec.ts
index 5d1496cafd..30428557ff 100644
--- a/modules/angular2/test/compiler/runtime_compiler_spec.ts
+++ b/modules/angular2/test/compiler/runtime_compiler_spec.ts
@@ -13,7 +13,7 @@ import {
beforeEachProviders
} from 'angular2/testing_internal';
-import {Component, View, provide} from 'angular2/core';
+import {Component, provide} from 'angular2/core';
import {PromiseWrapper} from 'angular2/src/facade/async';
import {SpyTemplateCompiler} from './spies';
import {TemplateCompiler} from 'angular2/src/compiler/compiler';
@@ -52,7 +52,6 @@ export function main() {
});
}
-@Component({selector: 'some-comp'})
-@View({template: ''})
+@Component({selector: 'some-comp', template: ''})
class SomeComponent {
}
diff --git a/modules/angular2/test/compiler/runtime_metadata_spec.ts b/modules/angular2/test/compiler/runtime_metadata_spec.ts
index bc8bce6ceb..e74a8cae8c 100644
--- a/modules/angular2/test/compiler/runtime_metadata_spec.ts
+++ b/modules/angular2/test/compiler/runtime_metadata_spec.ts
@@ -18,7 +18,6 @@ import {RuntimeMetadataResolver} from 'angular2/src/compiler/runtime_metadata';
import {LifecycleHooks, LIFECYCLE_HOOKS_VALUES} from 'angular2/src/core/linker/interfaces';
import {
Component,
- View,
Directive,
ViewEncapsulation,
ChangeDetectionStrategy,
@@ -125,9 +124,7 @@ class ComponentWithoutModuleId {
},
exportAs: 'someExportAs',
moduleId: 'someModuleId',
- changeDetection: ChangeDetectionStrategy.CheckAlways
-})
-@View({
+ changeDetection: ChangeDetectionStrategy.CheckAlways,
template: 'someTemplate',
templateUrl: 'someTemplateUrl',
encapsulation: ViewEncapsulation.Emulated,
diff --git a/modules/angular2/test/compiler/template_compiler_spec.ts b/modules/angular2/test/compiler/template_compiler_spec.ts
index 259b2c1a1c..8826bb8a81 100644
--- a/modules/angular2/test/compiler/template_compiler_spec.ts
+++ b/modules/angular2/test/compiler/template_compiler_spec.ts
@@ -37,7 +37,7 @@ import {AppView, AppProtoView} from 'angular2/src/core/linker/view';
import {AppElement} from 'angular2/src/core/linker/element';
import {Locals, ChangeDetectorGenConfig} from 'angular2/src/core/change_detection/change_detection';
-import {Component, View, Directive, provide, RenderComponentType} from 'angular2/core';
+import {Component, Directive, provide, RenderComponentType} from 'angular2/core';
import {TEST_PROVIDERS} from './test_bindings';
import {
@@ -338,9 +338,7 @@ export class UpperCasePipe implements PipeTransform {
selector: 'comp-a',
host: {'[title]': '\'someHostValue\''},
moduleId: THIS_MODULE_ID,
- exportAs: 'someExportAs'
-})
-@View({
+ exportAs: 'someExportAs',
template: '',
styles: ['div {color: red}'],
encapsulation: ViewEncapsulation.None,
@@ -349,8 +347,9 @@ export class UpperCasePipe implements PipeTransform {
export class CompWithBindingsAndStylesAndPipes {
}
-@Component({selector: 'tree', moduleId: THIS_MODULE_ID})
-@View({
+@Component({
+ selector: 'tree',
+ moduleId: THIS_MODULE_ID,
template: '',
directives: [TreeComp],
encapsulation: ViewEncapsulation.None
@@ -358,8 +357,9 @@ export class CompWithBindingsAndStylesAndPipes {
export class TreeComp {
}
-@Component({selector: 'comp-wit-dup-tpl', moduleId: THIS_MODULE_ID})
-@View({
+@Component({
+ selector: 'comp-wit-dup-tpl',
+ moduleId: THIS_MODULE_ID,
template: '',
directives: [TreeComp, TreeComp],
encapsulation: ViewEncapsulation.None
@@ -367,13 +367,18 @@ export class TreeComp {
export class CompWithDupDirectives {
}
-@Component({selector: 'comp-url', moduleId: THIS_MODULE_ID})
-@View({templateUrl: 'compUrl.html', encapsulation: ViewEncapsulation.None})
+@Component({
+ selector: 'comp-url',
+ moduleId: THIS_MODULE_ID,
+ templateUrl: 'compUrl.html',
+ encapsulation: ViewEncapsulation.None
+})
export class CompWithTemplateUrl {
}
-@Component({selector: 'comp-tpl', moduleId: THIS_MODULE_ID})
-@View({
+@Component({
+ selector: 'comp-tpl',
+ moduleId: THIS_MODULE_ID,
template: '',
encapsulation: ViewEncapsulation.None
})
@@ -382,18 +387,22 @@ export class CompWithEmbeddedTemplate {
@Directive({selector: 'plain'})
-@View({template: ''})
export class NonComponent {
}
-@Component({selector: 'comp2', moduleId: THIS_MODULE_ID})
-@View({template: '', encapsulation: ViewEncapsulation.None})
+@Component({
+ selector: 'comp2',
+ moduleId: THIS_MODULE_ID,
+ template: '',
+ encapsulation: ViewEncapsulation.None
+})
export class Comp2 {
}
-@Component({selector: 'comp1', moduleId: THIS_MODULE_ID})
-@View({
+@Component({
+ selector: 'comp1',
+ moduleId: THIS_MODULE_ID,
template: ', ',
encapsulation: ViewEncapsulation.None,
directives: [Comp2]
@@ -401,8 +410,9 @@ export class Comp2 {
export class Comp1 {
}
-@Component({selector: 'comp-with-2nested', moduleId: THIS_MODULE_ID})
-@View({
+@Component({
+ selector: 'comp-with-2nested',
+ moduleId: THIS_MODULE_ID,
template: ', ',
encapsulation: ViewEncapsulation.None,
directives: [Comp1, Comp2]
diff --git a/modules/angular2/test/core/debug/debug_node_spec.ts b/modules/angular2/test/core/debug/debug_node_spec.ts
index e0cd2b0dbd..db64592692 100644
--- a/modules/angular2/test/core/debug/debug_node_spec.ts
+++ b/modules/angular2/test/core/debug/debug_node_spec.ts
@@ -22,7 +22,7 @@ import {Injectable} from 'angular2/core';
import {NgFor, NgIf} from 'angular2/common';
import {By} from 'angular2/platform/common_dom';
-import {Directive, Component, View, Input} from 'angular2/src/core/metadata';
+import {Directive, Component, Input} from 'angular2/src/core/metadata';
@Injectable()
class Logger {
@@ -43,8 +43,8 @@ class MessageDir {
set message(newMessage) { this.logger.add(newMessage); }
}
-@Component({selector: 'child-comp'})
-@View({
+@Component({
+ selector: 'child-comp',
template: `
{{val1}}
diff --git a/modules/playground/src/gestures/index.ts b/modules/playground/src/gestures/index.ts
index 24d3535f68..5ffb99b6fa 100644
--- a/modules/playground/src/gestures/index.ts
+++ b/modules/playground/src/gestures/index.ts
@@ -1,8 +1,7 @@
import {bootstrap} from 'angular2/bootstrap';
-import {Component, View} from 'angular2/core';
+import {Component} from 'angular2/core';
-@Component({selector: 'gestures-app'})
-@View({templateUrl: 'template.html'})
+@Component({selector: 'gestures-app', templateUrl: 'template.html'})
class GesturesCmp {
swipeDirection: string = '-';
pinchScale: number = 1;
diff --git a/modules/playground/src/key_events/index.ts b/modules/playground/src/key_events/index.ts
index 73af757b7e..8ddc3ec08e 100644
--- a/modules/playground/src/key_events/index.ts
+++ b/modules/playground/src/key_events/index.ts
@@ -1,9 +1,9 @@
import {bootstrap} from 'angular2/bootstrap';
-import {Component, View} from 'angular2/core';
+import {Component} from 'angular2/core';
import {KeyEventsPlugin} from 'angular2/src/platform/dom/events/key_events';
-@Component({selector: 'key-events-app'})
-@View({
+@Component({
+ selector: 'key-events-app',
template: `Click in the following area and press a key to display its name:
{{lastKey}}
Click in the following area and press shift.enter:
diff --git a/modules/playground/src/material/button/index.ts b/modules/playground/src/material/button/index.ts
index 272c4e9100..1f57940627 100644
--- a/modules/playground/src/material/button/index.ts
+++ b/modules/playground/src/material/button/index.ts
@@ -1,5 +1,5 @@
import {bootstrap} from 'angular2/bootstrap';
-import {bind, provide, Component, View, ViewEncapsulation} from 'angular2/core';
+import {bind, provide, Component, ViewEncapsulation} from 'angular2/core';
import {NgFor} from 'angular2/common';
import {UrlResolver} from 'angular2/compiler';
import {MdButton, MdAnchor} from 'angular2_material/src/components/button/button';
@@ -7,8 +7,6 @@ import {commonDemoSetup, DemoUrlResolver} from '../demo_common';
@Component({
selector: 'demo-app',
-})
-@View({
templateUrl: './demo_app.html',
directives: [MdButton, MdAnchor, NgFor],
encapsulation: ViewEncapsulation.None
diff --git a/modules/playground/src/material/checkbox/index.ts b/modules/playground/src/material/checkbox/index.ts
index 7e0d705a1b..05ccff3df3 100644
--- a/modules/playground/src/material/checkbox/index.ts
+++ b/modules/playground/src/material/checkbox/index.ts
@@ -1,5 +1,5 @@
import {bootstrap} from 'angular2/bootstrap';
-import {bind, provide, Component, Directive, View, ViewEncapsulation} from 'angular2/core';
+import {bind, provide, Component, Directive, ViewEncapsulation} from 'angular2/core';
import {UrlResolver} from 'angular2/compiler';
import {MdCheckbox} from 'angular2_material/src/components/checkbox/checkbox';
import {commonDemoSetup, DemoUrlResolver} from '../demo_common';
@@ -7,8 +7,6 @@ import {commonDemoSetup, DemoUrlResolver} from '../demo_common';
@Component({
selector: 'demo-app',
-})
-@View({
templateUrl: './demo_app.html',
directives: [MdCheckbox],
encapsulation: ViewEncapsulation.None
diff --git a/modules/playground/src/material/dialog/index.ts b/modules/playground/src/material/dialog/index.ts
index af7df74fd1..7d450ef1e7 100644
--- a/modules/playground/src/material/dialog/index.ts
+++ b/modules/playground/src/material/dialog/index.ts
@@ -1,13 +1,5 @@
import {bootstrap} from 'angular2/bootstrap';
-import {
- bind,
- provide,
- ElementRef,
- ComponentRef,
- Component,
- View,
- ViewEncapsulation
-} from 'angular2/core';
+import {bind, provide, ElementRef, ComponentRef, Component, ViewEncapsulation} from 'angular2/core';
import {UrlResolver} from 'angular2/compiler';
import {
MdDialog,
@@ -21,8 +13,6 @@ import {isPresent} from 'angular2/src/facade/lang';
@Component({
selector: 'demo-app',
viewProviders: [MdDialog],
-})
-@View({
templateUrl: './demo_app.html',
directives: [],
encapsulation: ViewEncapsulation.None,
@@ -69,8 +59,6 @@ class DemoApp {
@Component({
selector: 'simple-dialog',
inputs: ['numCoconuts'],
-})
-@View({
encapsulation: ViewEncapsulation.None,
template: `
This is the dialog content
diff --git a/modules/playground/src/material/grid_list/index.ts b/modules/playground/src/material/grid_list/index.ts
index 1bbb17f48f..7f507810cd 100644
--- a/modules/playground/src/material/grid_list/index.ts
+++ b/modules/playground/src/material/grid_list/index.ts
@@ -1,5 +1,5 @@
import {bootstrap} from 'angular2/bootstrap';
-import {bind, provide, Component, View, ViewEncapsulation} from 'angular2/core';
+import {bind, provide, Component, ViewEncapsulation} from 'angular2/core';
import {MdGridList, MdGridTile} from 'angular2_material/src/components/grid_list/grid_list';
import {UrlResolver} from 'angular2/compiler';
import {commonDemoSetup, DemoUrlResolver} from '../demo_common';
@@ -7,8 +7,6 @@ import {commonDemoSetup, DemoUrlResolver} from '../demo_common';
@Component({
selector: 'demo-app',
-})
-@View({
templateUrl: './demo_app.html',
directives: [MdGridList, MdGridTile],
encapsulation: ViewEncapsulation.None,
diff --git a/modules/playground/src/material/input/index.ts b/modules/playground/src/material/input/index.ts
index 38a55ff721..b77c1581c3 100644
--- a/modules/playground/src/material/input/index.ts
+++ b/modules/playground/src/material/input/index.ts
@@ -1,11 +1,11 @@
import {bootstrap} from 'angular2/bootstrap';
-import {bind, provide, Component, View, ViewEncapsulation} from 'angular2/core';
+import {bind, provide, Component, ViewEncapsulation} from 'angular2/core';
import {MdInputContainer, MdInput} from 'angular2_material/src/components/input/input';
import {UrlResolver} from 'angular2/compiler';
import {commonDemoSetup, DemoUrlResolver} from '../demo_common';
-@Component({selector: 'demo-app'})
-@View({
+@Component({
+ selector: 'demo-app',
templateUrl: './demo_app.html',
directives: [MdInputContainer, MdInput],
encapsulation: ViewEncapsulation.None
diff --git a/modules/playground/src/material/progress-linear/index.ts b/modules/playground/src/material/progress-linear/index.ts
index c6673a7b3c..88e91af3bc 100644
--- a/modules/playground/src/material/progress-linear/index.ts
+++ b/modules/playground/src/material/progress-linear/index.ts
@@ -1,13 +1,11 @@
import {bootstrap} from 'angular2/bootstrap';
-import {bind, provide, Component, View, ViewEncapsulation} from 'angular2/core';
+import {bind, provide, Component, ViewEncapsulation} from 'angular2/core';
import {MdProgressLinear} from 'angular2_material/src/components/progress-linear/progress_linear';
import {UrlResolver} from 'angular2/src/compiler/url_resolver';
import {commonDemoSetup, DemoUrlResolver} from '../demo_common';
@Component({
selector: 'demo-app',
-})
-@View({
templateUrl: './demo_app.html',
directives: [MdProgressLinear],
encapsulation: ViewEncapsulation.None,
diff --git a/modules/playground/src/material/radio/index.ts b/modules/playground/src/material/radio/index.ts
index 9f7a5f275b..171f0b4dfa 100644
--- a/modules/playground/src/material/radio/index.ts
+++ b/modules/playground/src/material/radio/index.ts
@@ -1,5 +1,5 @@
import {bootstrap} from 'angular2/bootstrap';
-import {bind, provide, Component, View, ViewEncapsulation} from 'angular2/core';
+import {bind, provide, Component, ViewEncapsulation} from 'angular2/core';
import {UrlResolver} from 'angular2/compiler';
import {MdRadioButton, MdRadioGroup} from 'angular2_material/src/components/radio/radio_button';
import {MdRadioDispatcher} from 'angular2_material/src/components/radio/radio_dispatcher';
@@ -8,8 +8,6 @@ import {commonDemoSetup, DemoUrlResolver} from '../demo_common';
@Component({
selector: 'demo-app',
viewProviders: [MdRadioDispatcher],
-})
-@View({
templateUrl: './demo_app.html',
directives: [MdRadioGroup, MdRadioButton],
encapsulation: ViewEncapsulation.None,
diff --git a/modules/playground/src/material/switcher/index.ts b/modules/playground/src/material/switcher/index.ts
index 759c5156df..f4d254c7ec 100644
--- a/modules/playground/src/material/switcher/index.ts
+++ b/modules/playground/src/material/switcher/index.ts
@@ -1,13 +1,11 @@
import {bootstrap} from 'angular2/bootstrap';
-import {bind, provide, Component, View, ViewEncapsulation} from 'angular2/core';
+import {bind, provide, Component, ViewEncapsulation} from 'angular2/core';
import {MdSwitch} from 'angular2_material/src/components/switcher/switch';
import {UrlResolver} from 'angular2/src/compiler/url_resolver';
import {commonDemoSetup, DemoUrlResolver} from '../demo_common';
@Component({
selector: 'demo-app',
-})
-@View({
templateUrl: './demo_app.html',
directives: [MdSwitch],
encapsulation: ViewEncapsulation.None,
diff --git a/modules/playground/src/model_driven_forms/index.ts b/modules/playground/src/model_driven_forms/index.ts
index 9c05b4e508..6f8c93128d 100644
--- a/modules/playground/src/model_driven_forms/index.ts
+++ b/modules/playground/src/model_driven_forms/index.ts
@@ -9,7 +9,7 @@ import {
NgIf,
NgFor
} from 'angular2/common';
-import {Component, Directive, View, Host} from 'angular2/core';
+import {Component, Directive, Host} from 'angular2/core';
import {RegExpWrapper, print, isPresent} from 'angular2/src/facade/lang';
import {AbstractControl} from 'angular2/common';
@@ -40,8 +40,9 @@ function creditCardValidator(c: AbstractControl): {[key: string]: boolean} {
* actual error message.
* To make it simple, we are using a simple map here.
*/
-@Component({selector: 'show-error', inputs: ['controlPath: control', 'errorTypes: errors']})
-@View({
+@Component({
+ selector: 'show-error',
+ inputs: ['controlPath: control', 'errorTypes: errors'],
template: `
{{errorMessage}}
`,
@@ -74,8 +75,9 @@ class ShowError {
}
-@Component({selector: 'model-driven-forms', viewProviders: [FormBuilder]})
-@View({
+@Component({
+ selector: 'model-driven-forms',
+ viewProviders: [FormBuilder],
template: `
Checkout Form (Model Driven)
diff --git a/modules/playground/src/person_management/index.ts b/modules/playground/src/person_management/index.ts
index a4696f8f74..11ad1af65e 100644
--- a/modules/playground/src/person_management/index.ts
+++ b/modules/playground/src/person_management/index.ts
@@ -1,5 +1,5 @@
import {bootstrap} from 'angular2/bootstrap';
-import {Component, Directive, View, Host, forwardRef, Provider, Injectable} from 'angular2/core';
+import {Component, Directive, Host, forwardRef, Provider, Injectable} from 'angular2/core';
import {NgIf, NgFor, FORM_DIRECTIVES} from 'angular2/common';
import {CONST_EXPR} from 'angular2/src/facade/lang';
@@ -76,8 +76,8 @@ class DataService {
// ---- components
-@Component({selector: 'full-name-cmp'})
-@View({
+@Component({
+ selector: 'full-name-cmp',
template: `
Edit Full Name
@@ -107,8 +107,8 @@ class FullNameComponent {
get person(): Person { return this._service.currentPerson; }
}
-@Component({selector: 'person-detail-cmp'})
-@View({
+@Component({
+ selector: 'person-detail-cmp',
template: `
{{person.fullName}}
@@ -155,8 +155,8 @@ class PersonsDetailComponent {
get person(): Person { return this._service.currentPerson; }
}
-@Component({selector: 'persons-cmp'})
-@View({
+@Component({
+ selector: 'persons-cmp',
template: `
FullName Demo
@@ -180,8 +180,9 @@ class PersonsComponent {
}
-@Component({selector: 'person-management-app', viewBindings: [DataService]})
-@View({
+@Component({
+ selector: 'person-management-app',
+ viewBindings: [DataService],
template: `
diff --git a/modules/playground/src/sourcemap/index.ts b/modules/playground/src/sourcemap/index.ts
index efd63749a9..3d927ab89e 100644
--- a/modules/playground/src/sourcemap/index.ts
+++ b/modules/playground/src/sourcemap/index.ts
@@ -1,11 +1,9 @@
import {BaseException, WrappedException} from 'angular2/src/facade/exceptions';
import {bootstrap} from 'angular2/bootstrap';
-import {Component, View} from 'angular2/core';
+import {Component} from 'angular2/core';
@Component({
selector: 'error-app',
-})
-@View({
template: `
`
})
diff --git a/modules/playground/src/template_driven_forms/index.ts b/modules/playground/src/template_driven_forms/index.ts
index 9fcd6e7c70..a6d4982942 100644
--- a/modules/playground/src/template_driven_forms/index.ts
+++ b/modules/playground/src/template_driven_forms/index.ts
@@ -1,5 +1,5 @@
import {bootstrap} from 'angular2/bootstrap';
-import {Component, Directive, View, Host, forwardRef, Provider} from 'angular2/core';
+import {Component, Directive, Host, forwardRef, Provider} from 'angular2/core';
import {
ControlGroup,
NgIf,
@@ -61,8 +61,9 @@ class CreditCardValidator {
* actual error message.
* To make it simple, we are using a simple map here.
*/
-@Component({selector: 'show-error', inputs: ['controlPath: control', 'errorTypes: errors']})
-@View({
+@Component({
+ selector: 'show-error',
+ inputs: ['controlPath: control', 'errorTypes: errors'],
template: `
{{errorMessage}}
`,
@@ -95,8 +96,8 @@ class ShowError {
}
-@Component({selector: 'template-driven-forms'})
-@View({
+@Component({
+ selector: 'template-driven-forms',
template: `
Checkout Form
diff --git a/modules/playground/src/todo/index.ts b/modules/playground/src/todo/index.ts
index 4cf77646b3..29fecae076 100644
--- a/modules/playground/src/todo/index.ts
+++ b/modules/playground/src/todo/index.ts
@@ -1,10 +1,14 @@
import {bootstrap} from 'angular2/bootstrap';
-import {Component, View} from 'angular2/core';
+import {Component} from 'angular2/core';
import {NgFor} from 'angular2/common';
import {Store, Todo, TodoFactory} from './services/TodoStore';
-@Component({selector: 'todo-app', viewProviders: [Store, TodoFactory]})
-@View({templateUrl: 'todo.html', directives: [NgFor]})
+@Component({
+ selector: 'todo-app',
+ viewProviders: [Store, TodoFactory],
+ templateUrl: 'todo.html',
+ directives: [NgFor]
+})
class TodoApp {
todoEdit: Todo = null;
diff --git a/modules/playground/src/web_workers/kitchen_sink/index_common.ts b/modules/playground/src/web_workers/kitchen_sink/index_common.ts
index 737ca013a0..06d59d3081 100644
--- a/modules/playground/src/web_workers/kitchen_sink/index_common.ts
+++ b/modules/playground/src/web_workers/kitchen_sink/index_common.ts
@@ -1,4 +1,4 @@
-import {Renderer, ElementRef, Component, Directive, View, Injectable} from 'angular2/core';
+import {Renderer, ElementRef, Component, Directive, Injectable} from 'angular2/core';
import {StringWrapper} from 'angular2/src/facade/lang';
// A service available to the Injector, used by the HelloCmp component.
@@ -33,10 +33,8 @@ class RedDec {
selector: 'hello-app',
// These are services that would be created if a class in the component's
// template tries to inject them.
- viewProviders: [GreetingService]
-})
-// The template for the component.
-@View({
+ viewProviders: [GreetingService],
+ // The template for the component.
// Expressions in the template (like {{greeting}}) are evaluated in the
// context of the HelloCmp class below.
template: `
{{greeting}} world!
diff --git a/modules/playground/src/web_workers/message_broker/index_common.ts b/modules/playground/src/web_workers/message_broker/index_common.ts
index 8b64abfb5c..ea716ca931 100644
--- a/modules/playground/src/web_workers/message_broker/index_common.ts
+++ b/modules/playground/src/web_workers/message_broker/index_common.ts
@@ -1,11 +1,10 @@
import {PromiseWrapper} from "angular2/src/facade/async";
-import {Component, View} from "angular2/core";
+import {Component} from "angular2/core";
import {ServiceMessageBrokerFactory, PRIMITIVE} from "angular2/platform/worker_app";
const ECHO_CHANNEL = "ECHO";
-@Component({selector: 'app'})
-@View({template: "
WebWorker MessageBroker Test
"})
+@Component({selector: 'app', template: "
WebWorker MessageBroker Test
"})
export class App {
constructor(private _serviceBrokerFactory: ServiceMessageBrokerFactory) {
var broker = _serviceBrokerFactory.createMessageBroker(ECHO_CHANNEL, false);
diff --git a/modules/playground/src/web_workers/router/index_common.ts b/modules/playground/src/web_workers/router/index_common.ts
index c19ff3b2cd..af57be334d 100644
--- a/modules/playground/src/web_workers/router/index_common.ts
+++ b/modules/playground/src/web_workers/router/index_common.ts
@@ -1,4 +1,4 @@
-import {Component, View} from 'angular2/core';
+import {Component} from 'angular2/core';
import {Start} from './components/start';
import {About} from './components/about';
import {Contact} from './components/contact';
diff --git a/modules/playground/src/web_workers/todo/index_common.ts b/modules/playground/src/web_workers/todo/index_common.ts
index 5f26ee6da2..0e020cfa79 100644
--- a/modules/playground/src/web_workers/todo/index_common.ts
+++ b/modules/playground/src/web_workers/todo/index_common.ts
@@ -1,9 +1,13 @@
-import {View, Component} from 'angular2/core';
+import {Component} from 'angular2/core';
import {NgFor, FORM_DIRECTIVES} from 'angular2/common';
import {Store, Todo, TodoFactory} from './services/TodoStore';
-@Component({selector: 'todo-app', viewProviders: [Store, TodoFactory]})
-@View({templateUrl: 'todo.html', directives: [NgFor, FORM_DIRECTIVES]})
+@Component({
+ selector: 'todo-app',
+ viewProviders: [Store, TodoFactory],
+ templateUrl: 'todo.html',
+ directives: [NgFor, FORM_DIRECTIVES]
+})
export class TodoApp {
todoEdit: Todo = null;
inputValue: string;
diff --git a/modules/playground/src/zippy_component/index.ts b/modules/playground/src/zippy_component/index.ts
index 45f17c8270..10e9acaf22 100644
--- a/modules/playground/src/zippy_component/index.ts
+++ b/modules/playground/src/zippy_component/index.ts
@@ -1,9 +1,9 @@
import {bootstrap} from 'angular2/bootstrap';
-import {Component, View} from 'angular2/core';
+import {Component} from 'angular2/core';
import {Zippy} from './zippy';
-@Component({selector: 'zippy-app'})
-@View({
+@Component({
+ selector: 'zippy-app',
template: `
This is some content.
diff --git a/tools/public_api_guard/public_api_spec.ts b/tools/public_api_guard/public_api_spec.ts
index 7a68565cf7..3edbe530a9 100644
--- a/tools/public_api_guard/public_api_spec.ts
+++ b/tools/public_api_guard/public_api_spec.ts
@@ -546,7 +546,6 @@ const CORE = [
'var Self:SelfFactory',
'var SkipSelf:SkipSelfFactory',
'var Type:any',
- 'var View:ViewFactory',
'var ViewChild:ViewChildFactory',
'var ViewChildren:ViewChildrenFactory',
'var ViewQuery:QueryFactory',
diff --git a/typing_spec/basic_spec.ts b/typing_spec/basic_spec.ts
index d3fb9f40bd..530681160b 100644
--- a/typing_spec/basic_spec.ts
+++ b/typing_spec/basic_spec.ts
@@ -1,10 +1,8 @@
-import {Component, View} from 'angular2/core';
+import {Component} from 'angular2/core';
import {bootstrap} from 'angular2/platform/browser';
@Component({
- selector: 'my-app'
-})
-@View({
+ selector: 'my-app',
template: '
Hello {{ name }}
'
})
// Component controller
diff --git a/typing_spec/router_spec.ts b/typing_spec/router_spec.ts
index e9738c016a..4ae58801cd 100644
--- a/typing_spec/router_spec.ts
+++ b/typing_spec/router_spec.ts
@@ -1,11 +1,9 @@
-import {Component, View} from 'angular2/core';
+import {Component} from 'angular2/core';
import {bootstrap} from 'angular2/platform/browser';
import {RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS} from 'angular2/router';
@Component({
- selector: 'my-app'
-})
-@View({
+ selector: 'my-app',
template: '