Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. auth.controller('register', ['$scope','$http','$timeout','$location', function($scope,$http,$timeout,$location){
  2.     $scope.register = function () {
  3.         let input = $scope.input;
  4.         input.password = $scope.input.password1;
  5.         if (input.password1 !== input.password2){
  6.             $scope.message = 'Podane hasła się nie zgadzają'
  7.         }
  8.         else if (input.name && input.surrname){
  9.             $scope.message = 'Wypełnij wszystkie pola'
  10.         }
  11.         else{
  12.             $http.post('/api/crete-user',input).then(function(response){
  13.                 $scope.message = response.data;
  14.                 $timeout(function() { $location.path("/");}, 3000);
  15.             }),function(){
  16.                 $scope.message = 'Nieoczekiwany błąd'
  17.             };
  18.         }
  19.     }
  20. }]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement