-
Notifications
You must be signed in to change notification settings - Fork 839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
putElement not working when using Restangular.copy() #728
Comments
I don't really know what's going on but I'll check it out. Can you please provide a jsfiddle or plunkr with the bug happening so that it's easy to debug it? THanks! |
I met a similar problem even w/o using Restangular.all('users').getList()
.then(function(users) {
users[0].name += 'a'
users.putElement(0)
.then(function(newUsers) {
console.log(newUsers.restangularCollection); // => false
console.log(newUsers.putElement); // => undefined But my restangular has many configs like |
This one can reproduce. The version is <!DOCTYPE html>
<html lang='en-US' ng-app='app'>
<head>
<meta charset='utf-8'>
<title>Simplest</title>
<script src='lib/lodash/dist/lodash.js'></script>
<script src='lib/angular/angular.js'></script>
<script src='lib/restangular/dist/restangular.js'></script>
<script type="text/javascript">
angular.module('app', ['restangular'])
.controller('Ctrl', function($scope, Restangular) {
Restangular.all('api').all('users').getList()
.then(function (users) {
$scope.users = users;
$scope.test = function () {
users[0].name = 'b';
users.putElement(0).then(function(newUsers) {
console.log(newUsers.restangularCollection);
console.log(newUsers.putElement);
})
};
});
});
</script>
</head>
<body ng-controller="Ctrl">
<p>
<button ng-click="test()">Test</button>
</p>
</body>
</html> |
Please checkout my test when you have time. |
Hi, I filed a PR includes the above tests and a possible fix. |
Any update on this, since 1.5.1 is now out? |
Please let me know if I'm not doing this in proper fashion, but the following is happening for me with 1.3.x and 1.4.0:
The above code returns an 'undefined is not a function' on putElement()
However if I do not use Restangular.copy but instead do:
No problems using putElement.
The text was updated successfully, but these errors were encountered: