angularjs - $location.path in function is altering scope object -
$scope.copyorder = function() { console.log($scope.products); copyorder.copying = true; copyorder.orderinfo = $scope.orderinfo; copyorder.products = $scope.products; console.log(copyorder.products); $location.path('/neworder'); }; when logging $scope.products shows $scope.products[0].imprint empty array when not. if take out $location.path array inside object shows has 1 object in it.
essentially, $location.path shows in log:
$scope.products[0].imprint[0] (its length) without $location.path:
$scope.products[0].imprint[1] i copying 2 large objects 1 controller (editing) (new).
edit: more code, , less code
$scope.copyorder = function() { console.log($scope.products); $location.path('/neworder'); }; this still returns $scope.products[0].imprint empty array when should have array 1 object.
$scope.copyorder = function() { console.log($scope.products); // shows $scope.products[0].imprint empty console.log($scope.products[0].imprint[0]); // shows object in array console.log(typeof $scope.products[0].imprint); // returns object , not array $location.path('/neworder'); }
Comments
Post a Comment