Difference between angular.copy() and assignment (=).

$cope.context = 'some text';
$scope.master = context;
Thus in the later case, if you we're to change something in $scope.master you would also change context.
But in $scope.master = angular.copy($scope.context);
 angular.copy() performs a deep copy of the argument - essentially creating a new object - whereas using the assignment operator = just assigns reference's.
For more details on angular.copy visit Here.
     

1 comment:

  1. AngularJS is a toolset for building the framework most suited to your application development. It is fully extensible and works well with other libraries. Every feature can be modified or replaced to suit your unique development workflow and feature needs. Read on to find out how.
    AngularJS Training Institute in Chennai

    ReplyDelete