Model to Model

oscar's Avatar


13 Mar, 2010 01:06 AM

What is the best way to establish communication between model? Let's say I have to models, one for the main view with all the configuration values, and another for one sub component. If the sub component model needs to perform an action based on one of the settings that is in the main model should I inject the main model into it?


  1. Support Staff 1 Posted by Till Schneidere... on 13 Mar, 2010 02:16 PM

    Till Schneidereit's Avatar

    I'd recommend using a command to update the sub component model.

    Let your main model dispatch an even to which you bind a command. Into
    this command, you inject both models and apply whatever updates you
    need to the sub component model.

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

Keyboard shortcuts


? 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