On this page
Improve this Doc View Source angular.copy
- function in module ng
 
Creates a deep copy of source, which should be an object or an array.
- If no destination is supplied, a copy of the object or array is created.
 - If a destination is provided, all of its elements (for arrays) or properties (for objects) are deleted and then all elements/properties from the source are copied to it.
 - If 
sourceis not an object or array (inc.nullandundefined),sourceis returned. - If 
sourceis identical todestinationan exception will be thrown. 
    Only enumerable properties are taken into account. Non-enumerable properties (both on 
  source and on destination) will be ignored.
   Usage
angular.copy(source, [destination]);
Arguments
| Param | Type | Details | 
|---|---|---|
| source | * | 
        The source that will be used to make a copy. Can be any type, including primitives,   | 
       
| destination 
          (optional)
           | 
        ObjectArray | 
        Destination into which the source is copied. If provided, must be of the same type as   | 
       
Returns
* | 
       The copy or updated   | 
      
© 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
 https://code.angularjs.org/1.5.11/docs/api/ng/function/angular.copy