angular-sails-bind icon indicating copy to clipboard operation
angular-sails-bind copied to clipboard

Associations are not two-way binding

Open iDVB opened this issue 11 years ago • 5 comments
trafficstars

If I have something like

tree.rings

and I...

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

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

iDVB avatar Jul 17 '14 02:07 iDVB

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.

diegopamio avatar Jul 21 '14 16:07 diegopamio

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

artur-krueger avatar Aug 28 '14 20:08 artur-krueger

@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"?

iDVB avatar Aug 30 '14 20:08 iDVB

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?

avimar avatar Nov 21 '14 07:11 avimar

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

diegopamio avatar May 04 '15 14:05 diegopamio