hi
i cant fetech woocommerce api in ionic
error:
Object { data: null, status: -1, headers: headersGetter/<(), config: Object, statusText: “” }
data.js
$http({
method: 'GET',
url: url,
timeout: CONFIG.request_timeout
}).then(
function(result) {
//console.log(result)
// This callback will be called asynchronously when the response is available.
last_fetch = result.data['products'].length;
// Get new data and combine with existing ones, remove duplicates (fail-safe)
data = _.union(data, result.data['products']);
deferred.resolve();
},
function(result) {
console.log(result)
deferred.reject();
}
);
return deferred.promise;
};
and this error in controllers.js
Was unable to fetch products data from the API.
$scope.loadMoreProducts = function() {
$rootScope.$broadcast('loading:show');
ProductsData.getProductsAsync($scope.productPage + 1).then(
// successCallback
function() {
$scope.productPage++;
$scope.products = ProductsData.getAll();
$scope.$broadcast('scroll.infiniteScrollComplete');
$rootScope.$broadcast('loading:hide');
},
// errorCallback
function() {
$rootScope.$broadcast('loading:hide');
console.warn("Was unable to fetch products data from the API.");
}
);
};