Advertisement
Guest User

Untitled

a guest
Aug 25th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. angular.module('starter.controllers')
  2. .controller('RegisterCtrl', function($scope, hasura, $ionicPopup) {
  3. $scope.loginData = {
  4. username: '',
  5. password: '',
  6. repassword: '',
  7. email: ''
  8. };
  9. $scope.doRegister= function() {
  10. if($scope.loginData.password !== $scope.loginData.repassword) {
  11. $ionicPopup.alert({
  12. title: 'Error',
  13. template: 'Passwords do not match'
  14. });
  15. } else {
  16. hasura.setUsername($scope.loginData.username);
  17. hasura.auth.signup($scope.loginData.password, {}, function(){
  18. console.log('signup success');
  19. $ionicPopup.alert({
  20. title: 'Success',
  21. template: 'Register success'
  22. });
  23. $scope.$apply();
  24. }, function(error){
  25. console.log('signup error');
  26. $ionicPopup.alert({
  27. title: 'Error',
  28. template: 'Register failed'
  29. });
  30. });
  31. }
  32. };
  33. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement