I have the following code to undo the changes:
$pageContent = content;
$scope.page = $pageContent.page;
var pageBackup = $pageContent.page;
$scope.cancelChanges = function() {
$scope.page = pageBackup;
$scope.$apply;
};
But when I change something in $scope.page
it also changes pageBackup
. Could someone explain the reason for this?