Currently, I am working on a controller that is responsible for saving address data and changing the location to the next page with the JSON response as a parameter. Here's the code snippet that handles this:
$routeProvider.when('/checkout/:checkOutAddress', {
templateUrl : 'partials/checkOut.html',
controller : 'myController'
});
Within the checkout controller, I am attempting to retrieve the value using the following code:
mCommerceApp.controller('myController', function($scope,$sessionStorage,$location,$routeParams,MCommerceService) {
$scope.checkOutAddress=$routeParams.checkOutAddress;
console.log($scope.checkOutAddress);
});
The issue I am encountering is that I am unable to extract the JSON value correctly. Instead of getting the desired JSON data, it appears as an object in the console log, displaying [object Object]. Can anyone provide guidance on how to properly extract the $routeParams as JSON?
Thank you.