Skip to content

Commit

Permalink
Made a promise.
Browse files Browse the repository at this point in the history
  • Loading branch information
meisenmann committed Apr 21, 2014
1 parent 40887c0 commit 562d78c
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions app/js/services/availableClasses.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ angular.module('GSB.services.availableClasses', ['GSB.config'])

// Get Available Subject Classes from Server

$http.get(globalConfig.baseURL + 'mockup/classes.json')
.success(function (data) {
return $http.get(globalConfig.baseURL + 'mockup/classes.json')
.then(function (response) {

$log.info('Available Classes loaded from server.');

var availClasses = data.results.bindings;
var availClasses = response.data.results.bindings;

for(var key in availClasses) {
if (availClasses.hasOwnProperty(key)) {
Expand All @@ -38,9 +38,9 @@ angular.module('GSB.services.availableClasses', ['GSB.config'])
);
}
}
})
.error(function () {
$log.error('Available Classes could not be loaded from server.');
}, function(error) {
$log.error(error, 'Available Classes could not be loaded from server.');
});
};

Expand Down Expand Up @@ -106,11 +106,9 @@ angular.module('GSB.services.availableClasses', ['GSB.config'])
//Retrieve Properties from Server and add them to availableProperties
return $http.get(globalConfig.baseURL + uri)
.then(function(response) {
$log.info('Response: ', response);
var availableProperties = createAvailablePropertyObject(response.data.results.bindings);
$log.info(' Properties loaded from: ' + uri, response);

$log.info('getaP', availableProperties);
return availableProperties;

}, function(response) {
Expand Down

0 comments on commit 562d78c

Please sign in to comment.