1
1
/** @module ng2_directives */ /** */
2
2
import {
3
- Component , ComponentResolver , ComponentFactory ,
3
+ Component , ComponentFactoryResolver , ComponentFactory ,
4
4
ViewContainerRef , ReflectiveInjector , InputMetadata , ComponentMetadata , ViewChild
5
5
} from '@angular/core' ;
6
6
import { Input } from "@angular/core" ;
@@ -52,7 +52,7 @@ const ng2ComponentInputs = (ng2CompClass: Type) => {
52
52
. filter ( x => x instanceof ComponentMetadata && ! ! x . inputs )
53
53
// Get the .inputs string array
54
54
. map ( x => x . inputs )
55
- . reduce ( flattenR )
55
+ . reduce ( flattenR , [ ] )
56
56
. map ( input => ( { token : input , prop : input } ) ) ;
57
57
58
58
return _props . concat ( inputs ) as InputMapping [ ] ;
@@ -139,7 +139,7 @@ export class UIView {
139
139
constructor (
140
140
public router : UIRouter ,
141
141
@Inject ( UIView . PARENT_INJECT ) public parent : ParentUIViewInject ,
142
- public compResolver : ComponentResolver ,
142
+ public compFactoryResolver : ComponentFactoryResolver ,
143
143
public viewContainerRef : ViewContainerRef
144
144
) { }
145
145
@@ -193,7 +193,7 @@ export class UIView {
193
193
rawProviders . push ( { provide : UIView . PARENT_INJECT , useValue : { context : config . viewDecl . $context , fqn : uiViewData . fqn } } ) ;
194
194
195
195
// Get the component class from the view declaration. TODO: allow promises?
196
- let componentType = < Type > viewDecl . component ;
196
+ let componentType = < any > viewDecl . component ;
197
197
198
198
let createComponent = ( factory : ComponentFactory < any > ) => {
199
199
let parentInjector = this . viewContainerRef . injector ;
@@ -218,7 +218,8 @@ export class UIView {
218
218
ref . changeDetectorRef . detectChanges ( ) ;
219
219
} ;
220
220
221
- this . compResolver . resolveComponent ( componentType ) . then ( createComponent ) ;
221
+ let factory = this . compFactoryResolver . resolveComponentFactory ( componentType ) ;
222
+ createComponent ( factory ) ;
222
223
}
223
224
}
224
225
0 commit comments