Hi all, i'm struggling with a tricky problem. The corresponding stack
overflow question is
here
http://stackoverflow.com/questions/20977037/bind-models-to-each-other-or-get-synchronised-computed-properties.
Sometimes the model abstraction is not enough, and you feel the need to
keep two different models synchronised.
For example, i have two lists connected by an [angular sortable][1], which
requires a model like the following:
left = [{name:"one"}, {name:"two"}];
right = [{name:"three"}];
But i want to allow the user to configure this also with a list of switches
implemented like checkboxes (angular `input.checkbox` directive). This
would require a model like:
elements = [{
name:"one",
position:"left"
}, {
name:"two",
position:"left"
}, {
name:"three",
position:"right"
}]
So in order to cleanly wire the views to some controllers, i need the
controllers to reflect some kind of *data view* of the same higher level
model. Or i need two models which can stay synchronised among them.
This is also referred around as having a *computed property* in the same
model, but the proposed solution is usually to use a function, which would
not provide a two way binding on the data returned by the function.
How to resolve this problem?
[1]: https://github.com/angular-ui/ui-sortable
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.