angular.js icon indicating copy to clipboard operation
angular.js copied to clipboard

angular.copy doesn't copy over none index properties of an array.

Open timothykim opened this issue 12 years ago • 0 comments

Steps to reproduce:

var arr = [1,2,3];
arr['foo'] = 'bar';
var copy = angular.copy(arr);
copy['foo'] == 'bar';  // this evaluates to false

Expected behavior:

copy['foo'] == 'bar';  // this should evaluate to true

Proposed fix:

This can be easily change by changing the for loop to for in statement in https://github.com/angular/angular.js/blob/04d5a5072fe45d5aa8ec9c027bae9d29ee56c2d1/src/Angular.js#L746

timothykim avatar Dec 03 '13 00:12 timothykim