@@ -11,6 +11,7 @@ import {trace} from "../common/trace";
11
11
import { Inject } from "angular2/core" ;
12
12
import { ViewContext , ViewConfig } from "../view/interface" ;
13
13
import { Ng2ViewDeclaration } from "./interface" ;
14
+ import { ng2ComponentInputs } from "./componentUtil" ;
14
15
15
16
/** @hidden */
16
17
let id = 0 ;
@@ -168,10 +169,20 @@ export class UiView {
168
169
let exclusions = [ UiView . PARENT_INJECT ] ;
169
170
providers = getProviders ( injector ) . filter ( x => exclusions . indexOf ( x . key . displayName ) === - 1 ) . concat ( providers ) ;
170
171
171
- // The 'controller' should be a Component class
172
- // TODO: pull from 'component' declaration, do not require template.
173
172
let component = < Type > viewDecl . component ;
174
- dcl . loadIntoLocation ( component , elementRef , "content" , providers ) . then ( ref => this . componentRef = ref ) ;
173
+ dcl . loadIntoLocation ( component , elementRef , "content" , providers ) . then ( ref => {
174
+ this . componentRef = ref ;
175
+
176
+ // TODO: wire uiCanExit and uiOnParamsChanged callbacks
177
+
178
+ // Set resolve data to matching @Input ("prop")
179
+ let inputs = ng2ComponentInputs ( component ) ;
180
+ let bindings = viewDecl [ 'bindings' ] || { } ;
181
+
182
+ inputs . map ( tuple => ( { prop : tuple . prop , resolve : bindings [ tuple . prop ] || tuple . resolve } ) )
183
+ . filter ( tuple => resolvables [ tuple . resolve ] !== undefined )
184
+ . forEach ( tuple => { ref . instance [ tuple . prop ] = resolvables [ tuple . resolve ] . data } ) ;
185
+ } ) ;
175
186
}
176
187
}
177
188
0 commit comments