I have written one factory which holds the data and I am using two controllers. I have passed one request to the factory to get the data. And then I am trying to display that data through another controller on a different page. I am successfully retrieving the data in one controller. But the moment I am trying to display that data in another html file though another controller nothing is coming up. I am not sure what went wrong.
This is factory function to fetch the data
productDetails.getProductDetails = function(sessionId,product){
console.log("Getting the product details")
var promise = $http({method : "POST",
url : "some_url",
data : {"some_data"}
})
promise.then(function(response){
productDetails.details = response
console.log(productDetails.details)
}, function(err){
console.log("Couldn't get the product details "+err)
})
}
This is how I am calling the factory function to get the data thhrough one controller
$scope.displayProductDetails = function(product){
var promiseProductDetails = productService.getProductDetails($scope.userSession,product);
window.location = "product-details.html"
}
And then in second controller I am trying to console the same data. But nothing came up.
Any help would be highly appreciated
Regards