YouAndWeb_TwoToc
a2ecfb85282bb782ae96a40499c728d5c266f710
YouAndWeb_TwoToc / client / app / account / signup / signup.controller.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
'use strict'; angular.module('dashboardApp') .controller('SignupCtrl', function($scope, Auth, $state, $window, datepickerPopupConfig) { $scope.user = {}; $scope.errors = {}; $scope.$watch('user', function() { $scope.user.name = $scope.user.firstName + ' ' + $scope.user.lastName; }, true); $scope.datepickers = { birthDate: false }; $scope.open = function($event, which, whichnot) { $event.preventDefault(); $event.stopPropagation(); $scope.datepickers[which]= true; $scope.datepickers[whichnot]= false; }; $scope.dateOptions = { 'year-format': 'yy', 'starting-day': 1, 'show-weeks': false }; datepickerPopupConfig.showButtonBar = false; datepickerPopupConfig.appendToBody = false; $scope.minDate = new Date(); $scope.minDateFine = new Date(); $scope.register = function(form) { $scope.submitted = true; if (form.$valid) { Auth.createUser({ name: $scope.user.name, firstNname: $scope.user.firstName, lastName: $scope.user.lastName, birthDate: $scope.user.birthDate, email: $scope.user.email, password: $scope.user.password }) .then(function() { // Account created, redirect to home $state.go('main'); }) .catch(function(err) { err = err.data; $scope.errors = {}; // Update validity of form fields that match the mongoose errors angular.forEach(err.errors, function(error, field) { form[field].$setValidity('mongoose', false); $scope.errors[field] = error.message; }); }); } }; $scope.loginOauth = function(provider) { $window.location.href = '/auth/' + provider; }; }); |
Commits for YouAndWeb_TwoToc/client/app/account/signup/signup.controller.js
Revision | Author | Commited | Message |
---|---|---|---|
a2ecfb ... | PTKDev | Fri 20 Nov, 2015 11:22:35 +0000 | TwoToc code |