1
votes

I'm using EmberJS with Ember-Data, and I'd like to avoid temporarily the two-way bindings when a model is bound to a controller. For instance, I have a project page where the project name is always shown in the header. The project edit form is able to update the project name. However, because of the two-way bindings, if project name is changed, it is also updated in real-time in the header.

I don't want that from a UX point of view, because it may seems to my users that the value is actually updated (because it changes in real-time in the header), while it actually does not (the form has to be submitted).

What I'd like is to be able to temporarily deactivate the two-way bindings when I'm in the context of the form.

PS: I thought first about unbinding the project name in the header, but this does not work, because if the form is actually updated, I want the project name in the header to be updated.

Thanks to everyone!

1

1 Answers

0
votes

You could check out the BufferedProxy pattern proposed by Kris Selden. More info here:

http://coryforsyth.com/2013/06/27/ember-buffered-proxy-and-method-missing/

The article refers to the older version Ember-Data where you got errors if you try to change a models attributes while the changes were being saved to the server or 'in flight'.. The essential concept of having a proxy that you can make changes should help you though.

You can see Kris talking about it at an EmberNYC meetup here: https://www.youtube.com/watch?v=ysduY0ocUoA