[n00bs] i just can't find example for service -> model

katopz's Avatar

katopz

05 Nov, 2010 05:33 PM

i follow 2-3 examples so far so good but i just can't find how to send vo data directly from service to model
it would be "05a" refer to this diagram http://www.robotlegs.org/diagram/

thanks

  1. 2 Posted by Stray on 05 Nov, 2010 05:42 PM

    Stray's Avatar

    Hi there,

    no worries, just inject your model into your service and populate it direct.

    Eg - in your context startup:

    mapSingletonOf(ISomeModel, SomeModel);

    and in your service

    [Inject]
    public var someModel:ISomeModel

    then you can use the someModel variable directly in the service. Best to use an interface for your model so that you don't couple it together too tightly.

    Hope that helps - ask more if you need to,

    Stray

  2. 3 Posted by katopz on 06 Nov, 2010 12:23 PM

    katopz's Avatar

    Hey Stray

    thx for reply, it's working now :)
    btw, this service -> model instruction should be write in docs somewhere?
    just curious that maybe i skip reading it...

    thanks!

  3. 4 Posted by Thomas Gillis on 17 Nov, 2010 01:22 PM

    Thomas Gillis's Avatar

    Hello all.
    I'm having a similar issue but mine is the model is null when I inject in into my service.

    This is my context:

    injector.mapSingleton(GameModel); injector.mapSingleton(FacebookService);

    Then in the constructor I try to access the injected GameModel. Should I override a function my service what extends actor like the onRegister() in a Mediator?

    Thanks!

  4. Support Staff 5 Posted by Shaun Smith on 17 Nov, 2010 10:44 PM

    Shaun Smith's Avatar
  5. 6 Posted by Thomas Gillis on 17 Nov, 2010 11:58 PM

    Thomas Gillis's Avatar

    Thank you Mr.Smith for helping this poor noob solve his problem! Worked like a charm and the page has been bookmarked for future reference :)

  6. Stray closed this discussion on 13 Feb, 2011 03:14 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac