Files
InventoryTraker-Box/InventoryTraker.Web/js/authentication/LoginController.js
T
2016-09-23 15:12:46 -04:00

29 lines
627 B
JavaScript

(function () {
'use strict';
window.app.controller('LoginController',
function($window, $http) {
var vm = this;
vm.errorMessage = null;
vm.loggingIn = false;
vm.login = login;
function login() {
vm.loggingIn = true;
vm.errorMessage = null;
$http.post("/Authentication/Login", { emailAddress: vm.emailAddress, password: vm.password })
.success(function() {
$window.location.href = "/";
})
.error(function(data) {
vm.errorMessage = "There was a problem logging in: " + data;
})
.finally(function() {
vm.loggingIn = false;
});
}
});
})();