netstix/public/js/controllers/registerController.js
2022-11-27 20:58:22 +08:00

22 lines
652 B
JavaScript

netstix.controller('RegisterController', ['UserAuth', '$window', '$scope', function(UserAuth, $window, $scope) {
var self = this;
self.register = function () {
$scope.error = false;
$scope.disabled = true;
UserAuth.register($scope.registerForm.username, $scope.registerForm.password)
.then(function () {
$window.location.href ='/#/achievements';
$scope.disabled = false;
$scope.registerForm = {};
})
.catch(function () {
$scope.error = true;
$scope.errorMessage = "Something went wrong!";
$scope.disabled = false;
$scope.registerForm = {};
});
};
}]);