arnaucube
arnaucube/darkID-prototypePublic Self-hosted repository
darkID-prototype/clientApp/GUI/views/signup/signup.js
clientApp/GUI/views/signup/signup.jsRaw
 1'use strict';
 2
 3angular.module('app.signup', ['ngRoute'])
 4
 5.config(['$routeProvider', function($routeProvider) {
 6  $routeProvider.when('/signup', {
 7    templateUrl: 'views/signup/signup.html',
 8    controller: 'SignupCtrl'
 9  });
10}])
11
12.controller('SignupCtrl', function($scope, $http, $routeParams, $rootScope) {
13    $scope.user = {};
14    $scope.signup = function() {
15      console.log('Doing signup', $scope.user);
16      $http({
17              url: $rootScope.server + 'signup',
18              method: "POST",
19              headers: {
20                  "Content-Type": undefined
21              },
22              data: $scope.user
23          })
24          .then(function(data) {
25                  console.log("data: ");
26                  console.log(data.data);
27                  window.location="/";
28
29              },
30              function(data) {
31                  console.log(data);
32              });
33
34    };
35});