Wallet/src/js/controllers/preferencesAlias.js
Gabriel Bazán 2b3fb7eea4 fix alias
2016-09-23 13:31:10 -03:00

26 lines
819 B
JavaScript

'use strict';
angular.module('copayApp.controllers').controller('preferencesAliasController',
function($scope, $timeout, $stateParams, $ionicHistory, gettextCatalog, configService, profileService, walletService) {
var wallet = profileService.getWallet($stateParams.walletId);
var walletId = wallet.credentials.walletId;
var config = configService.getSync();
$scope.walletName = wallet.credentials.walletName;
$scope.alias = {
value: (config.aliasFor && config.aliasFor[walletId]) || wallet.credentials.walletName
};
$scope.save = function() {
var opts = {
aliasFor: {}
};
opts.aliasFor[walletId] = $scope.alias.value;
configService.set(opts, function(err) {
if (err) $log.warn(err);
$ionicHistory.goBack();
});
};
});