mgonto/restangular — pull request #627 by cyber-tron (2014-03-14 09:55:40+00:00)
Title: Allow a target element in Restangular.copy

When response data in a PUT request is modified by the server, it might be handy to merge the changed data into the source object. This is necessary, when the object reference is already used in other places, like in an ng-repeat loop (e.g. the child scope updates the object but the parent scope performs some sort of aggregation).

Therefore, we would like to allow a second parameter for Restangular.copy:
```
Restangular.all('foo').getList().then(function (foos) {
var foo = foos[0];
foo.bar = 'blubb';
foo.put().then(function (data) {
Restangular.copy(data, foo);
// (foos[0] === foo) && (foo.bar === data.bar)
});
});
```