EVOLUTION-MANAGER
Edit File: angular.copy.html
<a href='https://github.com/angular/angular.js/edit/v1.3.x/src/Angular.js?message=docs(angular.copy)%3A%20describe%20your%20change...#L650' class='improve-docs btn btn-primary'><i class="glyphicon glyphicon-edit"> </i>Improve this Doc</a> <a href='https://github.com/angular/angular.js/tree/v1.3.9/src/Angular.js#L650' class='view-source pull-right btn btn-primary'> <i class="glyphicon glyphicon-zoom-in"> </i>View Source </a> <header class="api-profile-header"> <h1 class="api-profile-header-heading">angular.copy</h1> <ol class="api-profile-header-structure naked-list step-list"> <li> - function in module <a href="api/ng">ng</a> </li> </ol> </header> <div class="api-profile-description"> <p>Creates a deep copy of <code>source</code>, which should be an object or an array.</p> <ul> <li>If no destination is supplied, a copy of the object or array is created.</li> <li>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.</li> <li>If <code>source</code> is not an object or array (inc. <code>null</code> and <code>undefined</code>), <code>source</code> is returned.</li> <li>If <code>source</code> is identical to 'destination' an exception will be thrown.</li> </ul> </div> <div> <h2 id="usage">Usage</h2> <p><code>angular.copy(source, [destination]);</code></p> <section class="api-section"> <h3>Arguments</h3> <table class="variables-matrix input-arguments"> <thead> <tr> <th>Param</th> <th>Type</th> <th>Details</th> </tr> </thead> <tbody> <tr> <td> source </td> <td> <a href="" class="label type-hint type-hint-object">*</a> </td> <td> <p>The source that will be used to make a copy. Can be any type, including primitives, <code>null</code>, and <code>undefined</code>.</p> </td> </tr> <tr> <td> destination <div><em>(optional)</em></div> </td> <td> <a href="" class="label type-hint type-hint-object">Object</a><a href="" class="label type-hint type-hint-array">Array</a> </td> <td> <p>Destination into which the source is copied. If provided, must be of the same type as <code>source</code>.</p> </td> </tr> </tbody> </table> </section> <h3>Returns</h3> <table class="variables-matrix return-arguments"> <tr> <td><a href="" class="label type-hint type-hint-object">*</a></td> <td><p>The copy or updated <code>destination</code>, if <code>destination</code> was specified.</p> </td> </tr> </table> <h2 id="example">Example</h2><p> <div> <a ng-click="openPlunkr('examples/example-example45')" class="btn pull-right"> <i class="glyphicon glyphicon-edit"> </i> Edit in Plunker</a> <div class="runnable-example" path="examples/example-example45" module="copyExample"> <div class="runnable-example-file" name="index.html" language="html" type="html"> <pre><code><div ng-controller="ExampleController"> <form novalidate class="simple-form"> Name: <input type="text" ng-model="user.name" /><br /> E-mail: <input type="email" ng-model="user.email" /><br /> Gender: <input type="radio" ng-model="user.gender" value="male" />male <input type="radio" ng-model="user.gender" value="female" />female<br /> <button ng-click="reset()">RESET</button> <button ng-click="update(user)">SAVE</button> </form> <pre>form = {{user | json}}</pre> <pre>master = {{master | json}}</pre> </div> <script> angular.module('copyExample', []) .controller('ExampleController', ['$scope', function($scope) { $scope.master= {}; $scope.update = function(user) { // Example with 1 argument $scope.master= angular.copy(user); }; $scope.reset = function() { // Example with 2 arguments angular.copy($scope.master, $scope.user); }; $scope.reset(); }]); </script></code></pre> </div> <iframe class="runnable-example-frame" src="examples/example-example45/index.html" name="example-example45"></iframe> </div> </div> </p> </div>