Skip to content

Commit

Permalink
feat(uiView): Support Components loaded via AppModule
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherthielen committed Aug 11, 2016
1 parent 30124bd commit 696148f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
10 changes: 5 additions & 5 deletions package.json
Expand Up @@ -54,11 +54,11 @@
},
"license": "MIT",
"devDependencies": {
"@angular/common": "=2.0.0-rc.3",
"@angular/compiler": "=2.0.0-rc.3",
"@angular/core": "=2.0.0-rc.3",
"@angular/platform-browser": "=2.0.0-rc.3",
"@angular/platform-browser-dynamic": "=2.0.0-rc.3",
"@angular/common": "=2.0.0-rc.5",
"@angular/compiler": "=2.0.0-rc.5",
"@angular/core": "=2.0.0-rc.5",
"@angular/platform-browser": "=2.0.0-rc.5",
"@angular/platform-browser-dynamic": "=2.0.0-rc.5",
"babel-core": "^5.8.14",
"clone": "^1.0.2",
"conventional-changelog": "^1.1.0",
Expand Down
11 changes: 6 additions & 5 deletions src/ng2/directives/uiView.ts
@@ -1,6 +1,6 @@
/** @module ng2_directives */ /** */
import {
Component, ComponentResolver, ComponentFactory,
Component, ComponentFactoryResolver, ComponentFactory,
ViewContainerRef, ReflectiveInjector, InputMetadata, ComponentMetadata, ViewChild
} from '@angular/core';
import {Input} from "@angular/core";
Expand Down Expand Up @@ -52,7 +52,7 @@ const ng2ComponentInputs = (ng2CompClass: Type) => {
.filter(x => x instanceof ComponentMetadata && !!x.inputs)
// Get the .inputs string array
.map(x => x.inputs)
.reduce(flattenR)
.reduce(flattenR, [])
.map(input => ({ token: input, prop: input }));

return _props.concat(inputs) as InputMapping[];
Expand Down Expand Up @@ -139,7 +139,7 @@ export class UIView {
constructor(
public router: UIRouter,
@Inject(UIView.PARENT_INJECT) public parent: ParentUIViewInject,
public compResolver: ComponentResolver,
public compFactoryResolver: ComponentFactoryResolver,
public viewContainerRef: ViewContainerRef
) { }

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

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

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

this.compResolver.resolveComponent(componentType).then(createComponent);
let factory = this.compFactoryResolver.resolveComponentFactory(componentType);
createComponent(factory);
}
}

1 comment on commit 696148f

@jspizziri
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @christopherthielen!

I was just wondering if there is a planned release to get this rc5 stuff out there anytime soon?

Thanks!

Please sign in to comment.