Angular.toJson method will strip dollar-prefixed properties from the object. So, this method, in pair with angular.fromJson
, will provide you with "clean" resource:
var myApp = angular.module('myApp', ['ngResource']);
myApp.controller('MyCtrl', function($scope, $resource) {
var ResourceA = $resource('A');
var ResourceB = $resource('B');
var instances = {};
instances.A = new ResourceA({
label: "Loading A ..."
});
var copy = angular.fromJson(angular.toJson(instances.A));
instances.B = new ResourceB(copy);
instances.B.$get(function(response) {
$scope.instances.B = response;
});
$scope.instances = instances;
});