cleanup(core): making @View optional

Closes #4566
This commit is contained in:
vsavkin 2015-10-06 19:14:45 -07:00 committed by Victor Savkin
parent d38689677c
commit dea6a4593b
4 changed files with 7 additions and 8 deletions

View File

@ -1701,7 +1701,7 @@ export function main() {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideView(MyComp, new ViewMetadata({ tcb.overrideView(MyComp, new ViewMetadata({
template: '<component-with-template></component-with-template>', template: '<component-with-template></component-with-template>',
directives: [ComponentWithTempalte] directives: [ComponentWithTemplate]
})) }))
.createAsync(MyComp) .createAsync(MyComp)
.then((rootTC) => { .then((rootTC) => {
@ -2270,7 +2270,7 @@ class DirectiveThrowingAnError {
selector: 'component-with-template', selector: 'component-with-template',
directives: [NgFor], template: `No View Decorator: <div *ng-for="#item of items">{{item}}</div>` directives: [NgFor], template: `No View Decorator: <div *ng-for="#item of items">{{item}}</div>`
}) })
class ComponentWithTempalte { class ComponentWithTemplate {
items = [1, 2, 3]; items = [1, 2, 3];
} }

View File

@ -26,15 +26,15 @@ class ComponentWithTemplate {
class ComponentWithViewTemplate { class ComponentWithViewTemplate {
} }
@Component({selector: 'sample'})
class ComponentWithoutView {
}
@Component({selector: 'sample', templateUrl: "some template url"}) @Component({selector: 'sample', templateUrl: "some template url"})
@View({template: "some template"}) @View({template: "some template"})
class ComponentWithViewTemplateUrl { class ComponentWithViewTemplateUrl {
} }
@Component({selector: 'sample'})
class ComponentWithoutView {
}
@View({template: "some template"}) @View({template: "some template"})
class ClassWithView { class ClassWithView {
} }

View File

@ -1,5 +1,5 @@
import {bootstrap} from 'angular2/bootstrap'; import {bootstrap} from 'angular2/bootstrap';
import {ElementRef, Component, Directive, View, Injectable} from 'angular2/core'; import {ElementRef, Component, Directive, Injectable} from 'angular2/core';
import {Renderer} from 'angular2/render'; import {Renderer} from 'angular2/render';
export function main() { export function main() {

View File

@ -195,7 +195,6 @@ class _DirectiveDependenciesVisitor extends Object
/// reflector. /// reflector.
@override @override
Object visitInstanceCreationExpression(InstanceCreationExpression node) { Object visitInstanceCreationExpression(InstanceCreationExpression node) {
// if (_isViewAnnotation(node)) {
if (_isViewAnnotation(node) || _isComponentAnnotation(node)) { if (_isViewAnnotation(node) || _isComponentAnnotation(node)) {
compileData = new NormalizedComponentWithViewDirectives( compileData = new NormalizedComponentWithViewDirectives(
null, <CompileDirectiveMetadata>[]); null, <CompileDirectiveMetadata>[]);