Best practice for managing / controlling object state with 2 way databinding

65 views
Skip to first unread message

ke...@qfin.net

unread,
Sep 8, 2014, 3:04:22 PM9/8/14
to polym...@googlegroups.com
I'm new to polymer (and getting back into web dev after a relatively long absence), and I'm wondering what the recommended approach might be to more closely manage object state while employing 2 way databinding.  I am currently consuming rest API (json) objects.  My question is if polymer keeps a copy of the original object before initiating updates to the bound object's properties/attributes...so one might be able to easily undo the changes?  While allowing 2 way databinding to work its magic is often desired, there are cases where I'd like to prevent / delay changes to the object / DOM until the user approves the changes (say via the paper-dialog component for instance).  I suppose one could make a temporary copy of the object and bind fields to that version, and then only persist the changes back to the source object upon user approval.  In any case, I'd be interested to hear thoughts and see an example or two of recommended approaches (especially if I am off-track with my ideas!)

ke...@qfin.net

unread,
Sep 8, 2014, 3:09:25 PM9/8/14
to polym...@googlegroups.com

Scott Miles

unread,
Sep 8, 2014, 4:04:29 PM9/8/14
to ke...@qfin.net, polymer-dev
See reply on SO.

Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/e31d47d5-0dd2-4b59-a8ce-10fd56ea7a95%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages