'use strict'; angular.module('warehost') .controller('SettingsCtrl',function(session,config,alert,$scope,$http){ $scope.obj = {}; alert.set({}); $scope.submit = function(){ if($scope.obj.newPassword === $scope.obj.repeatPassword){ $http.post(config.api+'/password',$scope.obj).then(function(res){ session.set(res); alert.set(res); $scope.obj = {}; }); }else{ alert.set({msg:'Not equal Passwords'}); } }; $scope.delete = function(){ if(window.confirm('realy delete your login and everything else on warehost?')){ $http.get(config.api+'/delete').then(function(res){ session.set(res); alert.set(res); }); }else{ alert.set({msg:'Account not deleted'}); } }; });