Created
August 5, 2014 14:39
-
-
Save raribeiro/a0eabe1467ad2b84d011 to your computer and use it in GitHub Desktop.
Service with angularJS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.factory('searchSchollService', ['$http', '$q', function($http, $q){ | |
var searchSchollService = {}; | |
searchSchollService.get = function(_param){ | |
return $http.get(config.url.school_search(_param)).then(function(result_search){ | |
if(typeof result_search.data === 'object'){ | |
return result_search.data; | |
}else{ | |
return $q.reject(result_search); | |
} | |
}, function(result_search){ | |
return $q.reject(result_search); | |
}); | |
}; | |
searchSchollService.enableSchool = function(_school_id){ | |
return $http({ | |
method: "POST", | |
url: config.url.enable_school, | |
data: { | |
school_id: _school_id | |
} | |
}); | |
}; | |
return searchSchollService; | |
}]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment