I have two variables. But updating 1 causes the other to update too. Can anyone explain what is happening here?
$scope.pages = [];
$scope.pagesSave = [];
var functionName = function(){
$service.doThing1().then(function(res1){
$scope.pagesSave = res1;
console.log(res1)
$service.doThing2().then(function(res2){
$scope.pages = $service.formatThings(res2, res1);
console.log($scope.pages)
}, function(err){});
}, function(err){});
$scope.pages should be the final product
$scope.pagesSave should be the pre-formatted data
however, console logging these variables show them as being identical.
More oddly, console logging immediately after doing $service.doThing1() shows "res1" as having the correct length but only containing the data from $scope.pages, as seen in this image.
2 are missing even though the formatting function hasn't happened yet
Anyone know whats happening here?
I'm using Chrome for console logs if that helps
