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