You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1012 B

  1. angular.module('app.password', ['pascalprecht.translate'])
  2. .controller('PasswordCtrl', function($scope, $stateParams, $translate,
  3. $http, $ionicLoading) {
  4. $scope.newPassword = {};
  5. $scope.changePassword = function() {
  6. console.log($scope.newPassword);
  7. $http({
  8. url: urlapi + 'changePassword',
  9. method: "PUT",
  10. data: $scope.newPassword
  11. })
  12. .then(function(data) {
  13. console.log(data);
  14. $ionicLoading.show({
  15. template: 'Password updated',
  16. noBackdrop: true,
  17. duration: 2000
  18. });
  19. window.location = "#app/settings";
  20. },
  21. function(data) { // optional
  22. // failed
  23. console.log(data);
  24. $ionicLoading.show({
  25. template: 'Error updating password',
  26. noBackdrop: true,
  27. duration: 2000
  28. });
  29. });
  30. };
  31. });