I'm extracting a JSON API URL in the framework ionic with AngularJs like the code below:
.factory('BuyApi', function($http) {
var obj = {};
obj.buy = function() {
var api = "https://maiscarrinho.com/api/search?q=gato&pageNumber=0&pageSize=10";
return $http.get(api);
};
return obj
})
.controller('MainControl', function($scope, BuyApi){
$scope.produtos;
BuyApi.buy().success(function(data) {
$scope.data = data;
$scope.produtos = data.results;
})
});
For the JSON file I use this URL: https://maiscarrinho.com/api/search?q=gato&pageNumber=0&pageSize=10, but every time you do an refresh on the page data changes (more exactly the prices) and it does not happen in the actual site : https://maiscarrinho.com/search?q=gato.
So I did an investigation might it be because the request and response header? Do I need to pass parameter? or something?
console.log(data)
afterBuyApi.buy().success(function(data) {
and you won't probably see anything in the console since the call won't be made. Maybe your application does not initialise properly?