Files
InventoryTracker/InventoryTraker.Web/js/authentication/LoginController.js
T

32 lines
654 B
JavaScript

(function() {
"use strict";
window.app.controller("LoginController",
[
"$window", "$http",
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;
});
}
}
]);
})();