Advertisement
Guest User

Untitled

a guest
Jun 7th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.84 KB | None | 0 0
  1. // amadeusounds.controller('ValidateController',
  2. // [
  3. // '$scope',
  4. // '$rootScope',
  5. // '$location',
  6. // '$filter',
  7. // 'UserService',
  8. //
  9. // function($scope, $rootScope, $location, $filter, UserService) {
  10. //
  11. // $scope.register = function() {
  12. // UserService.authenticate($.param({
  13. // first: $scope.first,
  14. // last: $scope.last,
  15. // email: $scope.email,
  16. // password: $scope.password,
  17. // image: $scope.image,
  18. // bio: $scope.bio,
  19. // website: $scope.website
  20. // }), function(authenticationResult) {
  21. // UserService.post(function(u) {
  22. // $rootScope.user = u;
  23. // alert("NAJAVEN");
  24. // });
  25. // $rootScope.loginAction = true;
  26. // if($rootScope.returnPath
  27. // && $rootScope.returnPath != "/login") {
  28. // $location.path($rootScope.returnPath);
  29. // delete $rootScope.returnPath;
  30. // } else {
  31. // $location.path("/");
  32. // }
  33. // alert("NAJAVEN JOK " + authenticationResult);
  34. // },
  35. // function() {
  36. // //toaster.pop('error', $filter('translate')('generic.login_error'),
  37. // // $filter('translate')('generic.invalid_username_or_password'));
  38. // alert("Greska pri najavuvanje");
  39. // });
  40. // };
  41. // }]);
  42.  
  43.  
  44. amadeusounds
  45. .controller('ValidateController', ['UserService', '$location', '$rootScope',
  46. function ValidateController(UserService, $location, $rootScope) {
  47. var vm = this;
  48.  
  49. vm.register =
  50. function() {
  51. alert("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0");
  52. vm.dataLoading = true;
  53. UserService.Create(vm.user)
  54. .then(function (response) {
  55. if (response.success) {
  56. //$scope.user=vm.user;
  57. // FlashService.Success('Registration successful', true);
  58. alert("REGISTRIRAN");
  59. $location.path('/login');
  60. } else {
  61. // FlashService.Error(response.message);
  62. vm.dataLoading = false;
  63. alert("NOOOOOO" + vm.user.first + vm.user.last);
  64. $location.path("/login");
  65. }
  66. });
  67. }
  68.  
  69. }]
  70.  
  71. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement