Advertisement
Guest User

Untitled

a guest
Oct 4th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. @RequestMapping(method = RequestMethod.POST,value = "/checkUserName", headers = "Accept=application/json")
  2. public org.weber.nag.model.UserRegistration checkUserName(@RequestBody org.weber.nag.model.UserRegistration userReg, Model model) {
  3. userDao.getAllUsers(userReg);
  4. System.out.println(userDao.getAllUsers(userReg));
  5. model.addAttribute("success", userReg);
  6. return userReg;
  7. }
  8.  
  9. angular.module('ngMailChimp', ['ngAria', 'ngMessages', 'ngAnimate'])
  10. .controller('SignUpController', function ($scope, $http) {
  11. var ctrl = this,
  12. newCustomer = { firstName:'',lastName:'',email:'',streetName:'',aptName:'',cityName:'',stateName:'',countryName:'', zipName:'', userName:'',password:'' };
  13.  
  14. var signup = function () {
  15. if( ctrl.signupForm.$valid) {
  16. ctrl.showSubmittedPrompt = true;
  17. userNameValidation();
  18. // submitForm();
  19. clearForm();
  20. }
  21. };
  22.  
  23.  
  24. var clearForm = function () {
  25. ctrl.newCustomer = { firstName:'',lastName:'',email:'',streetName:'',aptName:'',cityName:'',stateName:'',countryName:'', zipName:'', userName:'',password:'' };
  26. ctrl.signupForm.$setUntouched();
  27. ctrl.signupForm.$setPristine();
  28. };
  29.  
  30. var submitForm = function() {
  31.  
  32. var formData = {
  33. 'firstName' : $scope.ctrl.newCustomer.firstName,
  34. 'lastName' : $scope.ctrl.newCustomer.lastName,
  35. 'email' : $scope.ctrl.newCustomer.email,
  36. 'streetName': $scope.ctrl.newCustomer.streetName,
  37. 'aptNumber' : $scope.ctrl.newCustomer.aptName,
  38. 'city' : $scope.ctrl.newCustomer.cityName,
  39. 'state' : $scope.ctrl.newCustomer.stateName,
  40. 'country' : $scope.ctrl.newCustomer.countryName,
  41. 'zip' : $scope.ctrl.newCustomer.zipName,
  42. 'userName' : $scope.ctrl.newCustomer.userName,
  43. 'password' : $scope.ctrl.newCustomer.password
  44. };
  45.  
  46. var response = $http.post('http://localhost:8080/Weber/user/save', formData);
  47. response.success(function(data, status, headers, config) {
  48. alert( "Congrats,"+JSON.stringify(data.firstName)+" Welcome aboard.");
  49. $scope.list.push(data);
  50. });
  51. response.error(function(data, status, headers, config) {
  52. alert( "Error Details1: " + JSON.stringify({data: data}));
  53. });
  54. }
  55.  
  56. var userNameValidation = function() {
  57.  
  58. var formData = {
  59. 'userName' : $scope.ctrl.newCustomer.userName
  60. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement