Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @RequestMapping(method = RequestMethod.POST,value = "/checkUserName", headers = "Accept=application/json")
- public org.weber.nag.model.UserRegistration checkUserName(@RequestBody org.weber.nag.model.UserRegistration userReg, Model model) {
- userDao.getAllUsers(userReg);
- System.out.println(userDao.getAllUsers(userReg));
- model.addAttribute("success", userReg);
- return userReg;
- }
- angular.module('ngMailChimp', ['ngAria', 'ngMessages', 'ngAnimate'])
- .controller('SignUpController', function ($scope, $http) {
- var ctrl = this,
- newCustomer = { firstName:'',lastName:'',email:'',streetName:'',aptName:'',cityName:'',stateName:'',countryName:'', zipName:'', userName:'',password:'' };
- var signup = function () {
- if( ctrl.signupForm.$valid) {
- ctrl.showSubmittedPrompt = true;
- userNameValidation();
- // submitForm();
- clearForm();
- }
- };
- var clearForm = function () {
- ctrl.newCustomer = { firstName:'',lastName:'',email:'',streetName:'',aptName:'',cityName:'',stateName:'',countryName:'', zipName:'', userName:'',password:'' };
- ctrl.signupForm.$setUntouched();
- ctrl.signupForm.$setPristine();
- };
- var submitForm = function() {
- var formData = {
- 'firstName' : $scope.ctrl.newCustomer.firstName,
- 'lastName' : $scope.ctrl.newCustomer.lastName,
- 'email' : $scope.ctrl.newCustomer.email,
- 'streetName': $scope.ctrl.newCustomer.streetName,
- 'aptNumber' : $scope.ctrl.newCustomer.aptName,
- 'city' : $scope.ctrl.newCustomer.cityName,
- 'state' : $scope.ctrl.newCustomer.stateName,
- 'country' : $scope.ctrl.newCustomer.countryName,
- 'zip' : $scope.ctrl.newCustomer.zipName,
- 'userName' : $scope.ctrl.newCustomer.userName,
- 'password' : $scope.ctrl.newCustomer.password
- };
- var response = $http.post('http://localhost:8080/Weber/user/save', formData);
- response.success(function(data, status, headers, config) {
- alert( "Congrats,"+JSON.stringify(data.firstName)+" Welcome aboard.");
- $scope.list.push(data);
- });
- response.error(function(data, status, headers, config) {
- alert( "Error Details1: " + JSON.stringify({data: data}));
- });
- }
- var userNameValidation = function() {
- var formData = {
- 'userName' : $scope.ctrl.newCustomer.userName
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement