AuthenticationService.js
908 Bytes
AIA.factory('AuthenticationService', function ($http, $q) {
return {
authenticateUser: function (userInfo) {
//alert('called service');
var deferred = $q.defer();
//$http({
// method: 'POST',
// url: 'http://localhost:95/API/api/Authenticate',
// data: { credentials: userInfo }
//})
$http.post('http://localhost:95/API/api/Authenticate', JSON.stringify(userInfo), {
headers: {
'Content-Type': 'application/json'
}
})
.success(function (data, status, headers, config) {
deferred.resolve(data);
}).error(function (data, status, headers, config) {
deferred.reject(status);
});
return deferred.promise;
}
}
});