<html ng-app="myApp">
<head>
  <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js"></script>
  <meta charset="utf-8">
  <title>angular.extend Örnek</title>
</head>
<body ng-controller="MyController" ng-cloak>
  <h1>angular.extend Örnek</h1>
  
  <h3>$scope.fruitArrayDestination</h3>
  <ol>
     <li ng-repeat="item in fruitArrayDestination">
       {{item}}
     </li>
   </ol>
  <h3>$scope.subjectObjectDestination - extend()</h3>
  {{subjectObjectDestination | json}}
</body>
</html>
var myApp= angular.module("myApp",[]);

myApp.controller("MyController",
  ["$scope", function($scope){
    $scope.fruitArraySource =["Elma","Mango"];
    $scope.fruitArrayDestination =["Orange","Grapes"];
    angular.copy($scope.fruitArraySource, $scope.fruitArrayDestination);
    
    $scope.studentObjectSource ={"isim":"Ahmet"};
    $scope.subjectObjectDestination ={"iş":"Front end developer"};
     angular.extend($scope.subjectObjectDestination,
                         $scope.studentObjectSource);
}]);

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. //cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.2/angular.min.js