Data Down, Actions up in reality


I have been working on the same ember application for over two years and two way data binding is something that has completely bit me time and time again. I’ve read the road map to ember 2.0 and I am in favour of the proposed data down and actions up approach, but I think ember could go further and embrace immutability further but that is another topic.

I’ve created this jsbin that works for single checkbox but what I am struggling with is how this would work if I had a number of text inputs. Obviously we don’t want to be passing a handler to each input like this:

<input type="password" value=password onChange={{action "handlePassWordChange"}} />
<input onChange={{action "handleNameChange"}}/>

In react, if I am only changing state, I can do something like this:

<input onChange={(event) => this.setState({value:})}/>

But what are people’s thoughts about to handle this in ember. What frightens me is that a hybrid approach will be proposed where 2 way databinding is used for some scenarios and not others which does not really seem like progression but I have no evidence that this is how it will work.

So I am keen to know what people’s thoughts are on this.


This sounds similar to the proposed explicit two-way bindings. Because one-way bindings are the default, you can explicitly opt-in to the immediate/mutable state change:

<input value={{mut firstName}}>
<input value={{mut lastName}}>

As described in the Road to Ember doc:

This is similar to the approach taken by React.Link, but we think that the use-case of form helpers is sufficiently common to make it ergonomic.

Although it’s perfectly possible that I could be missing the intricacies that worry you about a hybrid approach - can you elaborate on that further?