@@ -752,7 +752,13 @@ function arrayRemove(array, value) {
752
752
* * If a destination is provided, all of its elements (for arrays) or properties (for objects)
753
753
* are deleted and then all elements/properties from the source are copied to it.
754
754
* * If `source` is not an object or array (inc. `null` and `undefined`), `source` is returned.
755
- * * If `source` is identical to 'destination' an exception will be thrown.
755
+ * * If `source` is identical to `destination` an exception will be thrown.
756
+ *
757
+ * <br />
758
+ * <div class="alert alert-warning">
759
+ * Only enumerable properties are taken into account. Non-enumerable properties (both on `source`
760
+ * and on `destination`) will be ignored.
761
+ * </div>
756
762
*
757
763
* @param {* } source The source that will be used to make a copy.
758
764
* Can be any type, including primitives, `null`, and `undefined`.
@@ -761,41 +767,42 @@ function arrayRemove(array, value) {
761
767
* @returns {* } The copy or updated `destination`, if `destination` was specified.
762
768
*
763
769
* @example
764
- <example module="copyExample">
765
- <file name="index.html">
766
- <div ng-controller="ExampleController">
767
- <form novalidate class="simple-form">
768
- Name: <input type="text" ng-model="user.name" /><br />
769
- E-mail: <input type="email" ng-model="user.email" /><br />
770
- Gender: <input type="radio" ng-model="user.gender" value="male" />male
771
- <input type="radio" ng-model="user.gender" value="female" />female<br />
772
- <button ng-click="reset()">RESET</button>
773
- <button ng-click="update(user)">SAVE</button>
774
- </form>
775
- <pre>form = {{user | json}}</pre>
776
- <pre>master = {{master | json}}</pre>
777
- </div>
778
-
779
- <script>
780
- angular.module('copyExample', [])
781
- .controller('ExampleController', ['$scope', function($scope) {
782
- $scope.master= {};
783
-
784
- $scope.update = function(user) {
785
- // Example with 1 argument
786
- $scope.master= angular.copy(user);
787
- };
770
+ <example module="copyExample">
771
+ <file name="index.html">
772
+ <div ng-controller="ExampleController">
773
+ <form novalidate class="simple-form">
774
+ <label>Name: <input type="text" ng-model="user.name" /></label><br />
775
+ <label>Age: <input type="number" ng-model="user.age" /></label><br />
776
+ Gender: <label><input type="radio" ng-model="user.gender" value="male" />male</label>
777
+ <label><input type="radio" ng-model="user.gender" value="female" />female</label><br />
778
+ <button ng-click="reset()">RESET</button>
779
+ <button ng-click="update(user)">SAVE</button>
780
+ </form>
781
+ <pre>form = {{user | json}}</pre>
782
+ <pre>master = {{master | json}}</pre>
783
+ </div>
784
+ </file>
785
+ <file name="script.js">
786
+ // Module: copyExample
787
+ angular.
788
+ module('copyExample', []).
789
+ controller('ExampleController', ['$scope', function($scope) {
790
+ $scope.master = {};
791
+
792
+ $scope.reset = function() {
793
+ // Example with 1 argument
794
+ $scope.user = angular.copy($scope.master);
795
+ };
788
796
789
- $scope.reset = function() {
790
- // Example with 2 arguments
791
- angular.copy($scope.master , $scope.user );
792
- };
797
+ $scope.update = function(user ) {
798
+ // Example with 2 arguments
799
+ angular.copy(user , $scope.master );
800
+ };
793
801
794
- $scope.reset();
795
- }]);
796
- </script>
797
- </file>
798
- </example>
802
+ $scope.reset();
803
+ }]);
804
+ </file>
805
+ </example>
799
806
*/
800
807
function copy ( source , destination ) {
801
808
var stackSource = [ ] ;
0 commit comments