harbor/static/ng/resources/js/layout/sign-up/sign-up.controller.js

42 lines
959 B
JavaScript
Raw Normal View History

2016-05-06 14:37:44 +02:00
(function() {
'use strict';
angular
.module('harbor.layout.sign.up')
.controller('SignUpController', SignUpController);
SignUpController.$inject = ['SignUpService', '$window'];
2016-05-06 14:37:44 +02:00
function SignUpController(SignUpService, $window) {
var vm = this;
vm.user = {};
vm.signUp = signUp;
function signUp(user) {
var userObject = {
'username': user.username,
'email': user.email,
'password': user.password,
'realname': user.fullName,
'comment': user.comments
2016-05-06 14:37:44 +02:00
};
SignUpService(userObject)
.success(signUpSuccess)
.error(signUpFailed);
2016-05-06 14:37:44 +02:00
}
function signUpSuccess(data, status) {
console.log('Signed up successfully:' + status);
alert('Signed up successfully');
$window.location.href = '/ng';
2016-05-06 14:37:44 +02:00
}
function signUpFailed(data, status) {
console.log('Signed up failed.');
2016-05-06 14:37:44 +02:00
}
}
})();