tag:robotlegs.tenderapp.com,2009-10-18:/discussions/questions/2275-injecting-a-view-into-another-viewRobotlegs: Discussion 2013-04-26T14:05:58Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/265859952013-04-26T17:11:02Z2013-04-26T17:11:02ZInjecting a view into another view<div><p>Hi poq,</p>
<p>You can’t inject into views in the latest versions of rl1.
You’d need the mediator of View2 to provide the view with an
injector like this:</p>
<pre>
<code>[Inject]
public var injector:IInjector;
[Inject]
public var view:View2;
override public function onRegister():void
{
injector.injectInto(view);
}</code>
</pre>
<p>You map View1 like this:</p>
<p>injector.mapValue(View1, new View1());</p>
<p>and in your View2 you inject it like this:</p>
<p>[Inject] public var view1:View1;</p>
<p>Hope that helps :)<br>
Ondina</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/265859952013-04-26T17:28:13Z2013-04-26T17:28:41ZInjecting a view into another view<div><p>Hi Ondina,</p>
<p>Great, it works!</p>
<p>For those interrested, I had to use a [PostConstruct] init
function in order to get it worked!</p>
<pre>
<code> [PostConstruct]
public function init():void
{
trace(view2, 'to check if it is null'); // And it is not!!
}</code>
</pre></div>poq2011tag:robotlegs.tenderapp.com,2009-10-18:Comment/265859952013-04-26T17:34:11Z2013-04-26T17:34:11ZInjecting a view into another view<div><p>Cool :)<br>
I'm going to close this.</p></div>Ondina D.F.