对于一个对象数组
$scope.content = [ {name:1}, {name:20} ]
第一种copy方法
$scope.content2 = angular.copy($scope.content) console.log($scope.content2);
第二种copy方法
angular.copy(source, [destination]);
参数名称 | 参数类型 | 描述 |
---|---|---|
source | * | 被copy的对象. 可以使任意类型, 包括null和undefined. |
destination (optional) | Object,array | copy去的目的地. 可以省略, 如果不省略, 其必须和source是同类 |