@@ -11,6 +11,7 @@ import {trace} from "../common/trace";
1111import { Inject } from "angular2/core" ;
1212import { ViewContext , ViewConfig } from "../view/interface" ;
1313import { Ng2ViewDeclaration } from "./interface" ;
14+ import { ng2ComponentInputs } from "./componentUtil" ;
1415
1516/** @hidden */
1617let id = 0 ;
@@ -168,10 +169,20 @@ export class UiView {
168169 let exclusions = [ UiView . PARENT_INJECT ] ;
169170 providers = getProviders ( injector ) . filter ( x => exclusions . indexOf ( x . key . displayName ) === - 1 ) . concat ( providers ) ;
170171
171- // The 'controller' should be a Component class
172- // TODO: pull from 'component' declaration, do not require template.
173172 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+ } ) ;
175186 }
176187}
177188
0 commit comments