Is there a way in Angular to avoid repeating http requests? As you can see in the code above I'm making a call to retrieve the detailed info of a product. The fact is that this call is associated to a button... I would to avoid repetitive calls. If I have clicked on the detailed-product-button obviously I don't need to make a call again to my service....the proper way will be to load the info once and then show and hided; but I don't know how to manage this on Angular. (also I don't want to load the detail product from the scrach for very product, I want to loaded only on user's clic demand, but once)
$scope.seeInfo= function(id){
$http.get('/shop/getDetailInfo/'+id).
success(function(data, status) {
$scope.info = data.detailinfo;
if (data.detailinfo>0) $scope.showDetails=true;
else $scope.showDetails=false;
});
};