I'm a beginner in AngularJS. I'm attempting to retrieve JSON data in my code using $http.get
, but it's throwing an error and the status is showing as -1.
What could be causing this issue?
RecordApp.factory('recordaccess', ['$http', function($http) {
$http.get('http://someurlforjson')
.success(function(data) {
return data;
})
.error(function(data, status, headers, config) {
alert("An error has occurred. Status: " + status);
});
}]);