diegopamio / angular-sails-bind

An angular service to bind scope models to sailsjs models thru socket
MIT License
136 stars 25 forks source link

Associations are not two-way binding #11

Open iDVB opened 10 years ago

iDVB commented 10 years ago

If I have something like

tree.rings

and I...

$sailsBind.bind("tree", $scope)

The trees are two-way binding, but the rings are not.

diegopamio commented 10 years ago

You're right, even though this service was made for sailsjs 0.10, I didn't consider the binding of associations... let me think you that could be accomplished. Or if you have any starting idea, drop it here.

artur-krueger commented 10 years ago

My experience was that it's quite difficult to work with populated data in conjuction with two way data binding. In order to change the associated object the populated data must be overwritten with the new Id.

tree.rings.Id = 1 // wrong tree.rings = 1 // ok

My solution was to deactivate popolation, bind the needed associated models also and to lookup the associated data by using an own angular filter whenever needed

iDVB commented 10 years ago

@artur-krueger Do you have any plunkr or any code you can paste in here to show how this can be done? Not sure what you mean about changing the associated object. Also, what do you mean about "looking up data by using an own angular filter"?

avimar commented 9 years ago

The associations show up as a model, but they aren't updateable. Are there any plans for this? Is there a way to turn off the "populate", just get the ID, and look them up separately?

diegopamio commented 9 years ago

mmmm... so, the sails-angular-bind plugin should do the "off" over population of associated models?