angular-meteor icon indicating copy to clipboard operation
angular-meteor copied to clipboard

Question: bindOne .save()?

Open jakobloekke opened this issue 11 years ago • 3 comments

What's the bindOne equivalent to .save()?

I have a bindOne set up for the logged in user – with 'auto' turned off: $collection(Meteor.users).bindOne($scope, 'user', $rootScope.currentUser._id, false);

I don't want to auto update, but I can't figure out how to persist the data after editing.

jakobloekke avatar Dec 07 '14 13:12 jakobloekke

You should add also regular bind in your controller and call the save function with the current user.

$collection(Meteor.users).bindOne($scope, 'user', $rootScope.currentUser._id, false);
$collection(Meteor.users).bind($scope, 'users');

$scope.users.save($scope.user);

Urigo avatar Dec 09 '14 01:12 Urigo

That seems to work. Thanks a lot. :)

jakobloekke avatar Dec 15 '14 15:12 jakobloekke

I've added an example also in the tutorial here:

http://angularjs.meteor.com/tutorial/step_06

Urigo avatar Dec 17 '14 18:12 Urigo