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: `
Child
@@ -58,8 +58,9 @@ class ChildComp { constructor() { this.childBinding = 'Original'; } } -@Component({selector: 'parent-comp', viewProviders: [Logger]}) -@View({ +@Component({ + selector: 'parent-comp', + viewProviders: [Logger], template: `
Parent
@@ -81,8 +82,8 @@ class CustomEmitter { constructor() { this.myevent = new EventEmitter(); } } -@Component({selector: 'events-comp'}) -@View({ +@Component({ + selector: 'events-comp', template: ` `, directives: [CustomEmitter], @@ -102,8 +103,9 @@ class EventsComp { handleCustom() { this.customed = true; } } -@Component({selector: 'cond-content-comp', viewProviders: [Logger]}) -@View({ +@Component({ + selector: 'cond-content-comp', + viewProviders: [Logger], template: `
`, directives: [NgIf, MessageDir], }) @@ -112,8 +114,9 @@ class ConditionalContentComp { myBool: boolean = false; } -@Component({selector: 'conditional-parent-comp', viewProviders: [Logger]}) -@View({ +@Component({ + selector: 'conditional-parent-comp', + viewProviders: [Logger], template: ` @@ -126,8 +129,9 @@ class ConditionalParentComp { constructor() { this.parentBinding = 'OriginalParent'; } } -@Component({selector: 'using-for', viewProviders: [Logger]}) -@View({ +@Component({ + selector: 'using-for', + viewProviders: [Logger], template: `