Consider the following example:
var ar = [4, 2, 3]; ar.$x = 'something'; var br = angular.copy(ar); console.dir(br);
br no longer has the $x property, because when copying an array, angular for (;;;) with for (;;;) , which does not see custom properties (if it is repeated using for in , then it will work).
Which of the following should I do?
- Create an array such as a class, and then assign the property;
- If this is an error, report angular;
- Change my code because assigning a property to an array is not good practice;
source share