Skip to content

putElement not working when using Restangular.copy() #728

@joelbowen

Description

@joelbowen

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:

Restangular.one('parent', parentId).all('childcollection').getList().then(function(collection) {
  $scope.childCollection = Restangular.copy(collection);
});

$scope.updateChildren = function(index) {
  $scope.childCollection.putElement(index).then(function(updatedCollection) {
    //Use updated collection    
  });
}

The above code returns an 'undefined is not a function' on putElement()

However if I do not use Restangular.copy but instead do:

Restangular.one('parent', parentId).all('childcollection').getList().then(function(collection) {
  $scope.childCollection = collection;
});

No problems using putElement.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions