I've got a piece of code that looks like this:

$scope.renameUser = function(key,name) {
  console.log('renameUser, key: ', key);
  console.log('renameUser, name: ', name);
  var userOne = $scope.users.$key(key);
  userOne.$key('displayName').$set(name);
};

It works, but you need to reload the page to see the updated result. I would like it to update instantly.

During debugging I added this part, but I never get it to trigger... Any ideas what is going on?

$scope.users.$on('set', opts, function(value) {
   console.log(value);
});
有帮助吗?

解决方案

This issue was introduced in v3.2.0. The $key method, whether it's being called on a model returned by a $goQuery or $goKey should return a 'new' model associated with a 'relative' key. Instead it was recycling the service associated with the first key used.

This issue has been fixed in v3.2.2, upgrading to this version should resolve your issue.

Thanks for sharing!

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top