-
Notifications
You must be signed in to change notification settings - Fork 0
/
services.js
33 lines (30 loc) · 1.17 KB
/
services.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
var app = angular.module('parkApp');
app.factory('getParkerings', ['$http', function ($http) {
var parkerings = {
resultSet: function () {
var url = `https://helsingborg.opendatasoft.com/api/records/1.0/search/?dataset=parkering_new`;
var data;
return $http.get(url)
.then(function onSuccess(response) {
// Handle success
data = response.data;
console.log(data);
var status = response.status;
var statusText = response.statusText;
var headers = response.headers;
var config = response.config;
return data.records;
})
.catch(function onError(response) {
// Handle error
data = response.data;
var status = response.status;
var statusText = response.statusText;
var headers = response.headers;
var config = response.config;
return "Error";
});
}
};
return parkerings;
}]);