Advertisement
amigleon92

Untitled

Aug 17th, 2018
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. /*
  2. * App setup del proyecto, se registra el módulo y sus depenencias
  3. */
  4. var app = angular.module(App.MODULE_NAME, ['ngRoute', 'ngTasty', 'ngMaterial', 'ngAnimate','smart-table',/* 'satellizer'*/]);
  5. /*app.controller("SignUpController", SignUpController)
  6. app.controller("LoginController", LoginController);
  7. app.controller("LogoutController", LogoutController);
  8.  
  9. function SignUpController($auth, $location) {
  10. var vm = this;
  11. this.signup = function() {
  12. $auth.signup({
  13. email: vm.email,
  14. password: vm.password
  15. })
  16. .then(function() {
  17. // Si se ha registrado correctamente,
  18. // Podemos redirigirle a otra parte
  19. $location.path("/private");
  20. })
  21. .catch(function(response) {
  22. // Si ha habido errores, llegaremos a esta función
  23. });
  24. }
  25. }
  26.  
  27. function LoginController($auth, $location) {
  28. var vm = this;
  29. this.login = function(){
  30. $auth.login({
  31. Username: "julio",
  32. password: "ciancio"
  33. })
  34. .then(function(){
  35. // Si se ha logueado correctamente, lo tratamos aquí.
  36. // Podemos también redirigirle a una ruta
  37. $location.path("/private")
  38. })
  39. .catch(function(response){
  40. // Si ha habido errores llegamos a esta parte
  41. });
  42. }
  43. }
  44.  
  45. function LogoutController($auth, $location) {
  46. $auth.logout()
  47. .then(function() {
  48. // Desconectamos al usuario y lo redirijimos
  49. $location.path("/")
  50. });
  51. }*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement