Advertisement
Guest User

Untitled

a guest
Nov 29th, 2016
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.93 KB | None | 0 0
  1. angular.module('your_app_name.auth.controllers', [])
  2.  
  3.  
  4. .controller('WelcomeCtrl', function($scope, $state, $ionicModal){
  5. // $scope.bgs = ["http://lorempixel.com/640/1136"];
  6. $scope.bgs = ["img/welcome-bg.jpeg"];
  7.  
  8. $scope.facebookSignIn = function(){
  9. console.log("doing facebbok sign in");
  10. $state.go('app.feed');
  11. };
  12.  
  13. $ionicModal.fromTemplateUrl('views/app/legal/privacy-policy.html', {
  14. scope: $scope,
  15. animation: 'slide-in-up'
  16. }).then(function(modal) {
  17. $scope.privacy_policy_modal = modal;
  18. });
  19.  
  20. $ionicModal.fromTemplateUrl('views/app/legal/terms-of-service.html', {
  21. scope: $scope,
  22. animation: 'slide-in-up'
  23. }).then(function(modal) {
  24. $scope.terms_of_service_modal = modal;
  25. });
  26.  
  27. $scope.showPrivacyPolicy = function() {
  28. $scope.privacy_policy_modal.show();
  29. };
  30.  
  31. $scope.showTerms = function() {
  32. $scope.terms_of_service_modal.show();
  33. };
  34. })
  35.  
  36. .controller('CreateAccountCtrl', function($scope, $state, $http){
  37. $scope.user ={
  38. email:'',
  39. phone:'',
  40. password:'',
  41. username:'',
  42. name:''
  43. }
  44. $scope.doSignUp = function(){
  45. console.log("doing sign up");
  46. var headers = new Headers();
  47. headers.append('x-parse-application-id', 'AppId1');
  48. headers.append('x-parse-rest-api-key', 'restAPIKey');
  49. headers.append('Content-Type','application/json')
  50.  
  51. var dataObject = {
  52. "first_name": $scope.name,
  53. "username": $scope.last_name,
  54. "passsword": $scope.passsword,
  55. "email": $scope.email
  56. };
  57. var dataObjectString = JSON.stringify(dataObject);
  58. var baseURL ="https://outing-zionnite.c9users.io/app1/classes/user";
  59. $http.post(baseURL, dataObjectString, {headers: headers})
  60. .then(function (response) {
  61. console.log('adding to parse', response);
  62. return response.data;
  63. });
  64.  
  65. //$state.go('app.feed');
  66.  
  67.  
  68. //$state.go('app.feed');
  69. };
  70. })
  71.  
  72. .controller('WelcomeBackCtrl', function($scope, $state, $ionicModal){
  73. $scope.doLogIn = function(){
  74. console.log("doing log in");
  75. $state.go('app.feed');
  76. };
  77.  
  78. $ionicModal.fromTemplateUrl('views/auth/forgot-password.html', {
  79. scope: $scope,
  80. animation: 'slide-in-up'
  81. }).then(function(modal) {
  82. $scope.forgot_password_modal = modal;
  83. });
  84.  
  85. $scope.showForgotPassword = function() {
  86. $scope.forgot_password_modal.show();
  87. };
  88.  
  89. $scope.requestNewPassword = function() {
  90. console.log("requesting new password");
  91. };
  92.  
  93. // //Cleanup the modal when we're done with it!
  94. // $scope.$on('$destroy', function() {
  95. // $scope.modal.remove();
  96. // });
  97. // // Execute action on hide modal
  98. // $scope.$on('modal.hidden', function() {
  99. // // Execute action
  100. // });
  101. // // Execute action on remove modal
  102. // $scope.$on('modal.removed', function() {
  103. // // Execute action
  104. // });
  105. })
  106.  
  107. .controller('ForgotPasswordCtrl', function($scope){
  108.  
  109. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement