DoclerLabs / hexMachina

Releases, issues, documentation, website of hexMachina, framework written in Haxe
http://hexmachina.org
MIT License
44 stars 8 forks source link

[doc] - mapToValue need injectInto to add injector on value #227

Open aliokan opened 7 years ago

aliokan commented 7 years ago

In module :

var controller = new OneController();
_injector.mapToValue( IOneController, controller );
class OneController implements ICommandTrigger implements IOneController
{
    public function showDialog():Void
    {
        trace(this.injector) // this.injector == null 
    }
}
FrancisBourre commented 7 years ago

You shoud inject into because its a value ;)

aliokan commented 7 years ago

Should be documented !

var controller = new OneController();
_injector.mapToValue( IOneController, controller );
_injector.mapToValue( IOne2Controller, controller );

_addStatefulConfigs( [statefulConfig] );

_injector.injectInto( controller );
FrancisBourre commented 7 years ago
_addStatefulConfigs( [statefulConfig] );

var controller = _injector.instantiateUnmapped( OneController );
_injector.mapToValue( IOneController, controller );
_injector.mapToValue( IOne2Controller, controller );

Does this one work for you? It should be better...

aliokan commented 7 years ago

Not in my case, because I need to inject controller in view defined statefulConfig