Skip to content

Commit 696148f

Browse files
feat(uiView): Support Components loaded via AppModule
1 parent 30124bd commit 696148f

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@
5454
},
5555
"license": "MIT",
5656
"devDependencies": {
57-
"@angular/common": "=2.0.0-rc.3",
58-
"@angular/compiler": "=2.0.0-rc.3",
59-
"@angular/core": "=2.0.0-rc.3",
60-
"@angular/platform-browser": "=2.0.0-rc.3",
61-
"@angular/platform-browser-dynamic": "=2.0.0-rc.3",
57+
"@angular/common": "=2.0.0-rc.5",
58+
"@angular/compiler": "=2.0.0-rc.5",
59+
"@angular/core": "=2.0.0-rc.5",
60+
"@angular/platform-browser": "=2.0.0-rc.5",
61+
"@angular/platform-browser-dynamic": "=2.0.0-rc.5",
6262
"babel-core": "^5.8.14",
6363
"clone": "^1.0.2",
6464
"conventional-changelog": "^1.1.0",

src/ng2/directives/uiView.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/** @module ng2_directives */ /** */
22
import {
3-
Component, ComponentResolver, ComponentFactory,
3+
Component, ComponentFactoryResolver, ComponentFactory,
44
ViewContainerRef, ReflectiveInjector, InputMetadata, ComponentMetadata, ViewChild
55
} from '@angular/core';
66
import {Input} from "@angular/core";
@@ -52,7 +52,7 @@ const ng2ComponentInputs = (ng2CompClass: Type) => {
5252
.filter(x => x instanceof ComponentMetadata && !!x.inputs)
5353
// Get the .inputs string array
5454
.map(x => x.inputs)
55-
.reduce(flattenR)
55+
.reduce(flattenR, [])
5656
.map(input => ({ token: input, prop: input }));
5757

5858
return _props.concat(inputs) as InputMapping[];
@@ -139,7 +139,7 @@ export class UIView {
139139
constructor(
140140
public router: UIRouter,
141141
@Inject(UIView.PARENT_INJECT) public parent: ParentUIViewInject,
142-
public compResolver: ComponentResolver,
142+
public compFactoryResolver: ComponentFactoryResolver,
143143
public viewContainerRef: ViewContainerRef
144144
) { }
145145

@@ -193,7 +193,7 @@ export class UIView {
193193
rawProviders.push({ provide: UIView.PARENT_INJECT, useValue: { context: config.viewDecl.$context, fqn: uiViewData.fqn } });
194194

195195
// Get the component class from the view declaration. TODO: allow promises?
196-
let componentType = <Type> viewDecl.component;
196+
let componentType = <any> viewDecl.component;
197197

198198
let createComponent = (factory: ComponentFactory<any>) => {
199199
let parentInjector = this.viewContainerRef.injector;
@@ -218,7 +218,8 @@ export class UIView {
218218
ref.changeDetectorRef.detectChanges();
219219
};
220220

221-
this.compResolver.resolveComponent(componentType).then(createComponent);
221+
let factory = this.compFactoryResolver.resolveComponentFactory(componentType);
222+
createComponent(factory);
222223
}
223224
}
224225

0 commit comments

Comments
 (0)