angular.module('odoo') .controller('PreferencesController', function ( $scope, $state, $ionicPopup, userStorageFactory ) { $scope.deleteAccount = function () { $ionicPopup.prompt({ title: 'Confirmar', template: 'Escriba ELIMINAR en el cuadro de abajo para confirmar', inputType: 'text', inputPlaceholder: 'ELIMINAR' }).then(function (answer) { if (answer == 'ELIMINAR') { userStorageFactory.remove(function (ok) { $state.go('configuration'); }, function (err) { $ionicPopup.alert({ title: 'No se ha podido eliminar el cliente', template: JSON.stringify(err) }); }); } }); } });