refactor(core): remove DynamicComponent

BREAKING CHANGE:
A dynamic component is just a component that has no @View annotation…
This commit is contained in:
Tobias Bosch
2015-04-29 16:52:34 -07:00
parent b71fe311fc
commit 8faf6364dc
17 changed files with 76 additions and 123 deletions
-8
View File
@@ -87,14 +87,6 @@ export function main() {
});
describe('bootstrap factory method', () => {
it('should throw if no View found', inject([AsyncTestCompleter], (async) => {
var refPromise = bootstrap(HelloRootMissingTemplate, testBindings, (e,t) => {throw e;});
PromiseWrapper.then(refPromise, null, (reason) => {
expect(reason.message).toContain('No template found for HelloRootMissingTemplate');
async.done();
});
}));
it('should throw if bootstrapped Directive is not a Component', inject([AsyncTestCompleter], (async) => {
var refPromise = bootstrap(HelloRootDirectiveIsNotCmp, testBindings, (e,t) => {throw e;});
PromiseWrapper.then(refPromise, null, (reason) => {
+4 -3
View File
@@ -21,7 +21,7 @@ import {Compiler, CompilerCache} from 'angular2/src/core/compiler/compiler';
import {AppProtoView} from 'angular2/src/core/compiler/view';
import {ElementBinder} from 'angular2/src/core/compiler/element_binder';
import {DirectiveMetadataReader} from 'angular2/src/core/compiler/directive_metadata_reader';
import {Component, DynamicComponent, Decorator} from 'angular2/src/core/annotations_impl/annotations';
import {Component, Decorator} from 'angular2/src/core/annotations_impl/annotations';
import {Attribute} from 'angular2/src/core/annotations_impl/di';
import {View} from 'angular2/src/core/annotations_impl/view';
import {internalProtoView} from 'angular2/src/core/compiler/view_ref';
@@ -490,7 +490,7 @@ class NestedComponent {}
class RecursiveComponent {}
@DynamicComponent()
@Component()
class SomeDynamicComponentDirective {}
@Decorator()
@@ -554,7 +554,8 @@ class FakeTemplateResolver extends TemplateResolver {
resolve(component: Type): View {
var template = MapWrapper.get(this._cmpTemplates, component);
if (isBlank(template)) {
throw 'No template';
// dynamic component
return null;
}
return template;
}
@@ -16,7 +16,7 @@ import {
import {TestBed} from 'angular2/src/test_lib/test_bed';
import {Decorator, Component, DynamicComponent} from 'angular2/src/core/annotations_impl/annotations';
import {Decorator, Component} from 'angular2/src/core/annotations_impl/annotations';
import {View} from 'angular2/src/core/annotations_impl/view';
import {DynamicComponentLoader} from 'angular2/src/core/compiler/dynamic_component_loader';
import {ElementRef} from 'angular2/src/core/compiler/element_ref';
@@ -229,7 +229,7 @@ class ChildComp {
class DynamicallyCreatedComponentService {
}
@DynamicComponent({
@Component({
selector: 'dynamic-comp'
})
class DynamicComp {
+1 -1
View File
@@ -24,7 +24,7 @@ import {Injector, bind} from 'angular2/di';
import {PipeRegistry, defaultPipeRegistry,
ChangeDetection, DynamicChangeDetection, Pipe, ChangeDetectorRef, ON_PUSH} from 'angular2/change_detection';
import {Decorator, Component, DynamicComponent} from 'angular2/src/core/annotations_impl/annotations';
import {Decorator, Component} from 'angular2/src/core/annotations_impl/annotations';
import {View} from 'angular2/src/core/annotations_impl/view';
import {Parent, Ancestor} from 'angular2/src/core/annotations_impl/visibility';
import {Attribute} from 'angular2/src/core/annotations_impl/di';