No subject

Marek's Avatar

Marek

07 Sep, 2012 02:25 PM

Some service methods in my Robotlegs app require parameters. I'm wondering which solution is better:
1. Mediators pass parameters to services
2. Services aquire parameters from injected models

  1. Support Staff 1 Posted by Ondina D.F. on 07 Sep, 2012 02:52 PM

    Ondina D.F.'s Avatar

    Hi Marek,

    1.Mediators pass parameters to services

    It sounds like you’re accessing Services from your Mediators. You can do that, if you want, but I have to tell you that the recommended practice is to avoid injecting Models and Services into your Mediators. It’s up to you, whether you follow the rules or not:)

    So, the better way would be:
    Mediators dispatch a custom event to trigger a Command that would access a Service. The payload of that custom event can contain the parameters needed by the Service. The Command can read that payload and pass it to Service’s method.

    2.Services aquire parameters from injected models

    Yes, you can do that. I answered a similar question here: http://knowledge.robotlegs.org/discussions/questions/995-the-optima...

    Does this answer your questions?

    Ondina

  2. 2 Posted by Marek on 07 Sep, 2012 02:58 PM

    Marek's Avatar

    It does answer my question

  3. Support Staff 3 Posted by Ondina D.F. on 07 Sep, 2012 03:06 PM

    Ondina D.F.'s Avatar

    Cool! Then I'll mark this discussion as resolved. Please open new threads for new issues.

  4. Ondina D.F. closed this discussion on 07 Sep, 2012 03:06 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