diff --git a/public/views/preferencesAltCurrency.html b/public/views/preferencesAltCurrency.html
index faab726c8..63b7ce908 100644
--- a/public/views/preferencesAltCurrency.html
+++ b/public/views/preferencesAltCurrency.html
@@ -1,20 +1,12 @@
-
-
-
-
-
+
-
- -
- {{altCurrency.name}}
-
-
-
-
+
+
{{altCurrency.name}}
+
+
diff --git a/src/js/controllers/preferencesAltCurrency.js b/src/js/controllers/preferencesAltCurrency.js
index 5f6a9c2cf..d14b80007 100644
--- a/src/js/controllers/preferencesAltCurrency.js
+++ b/src/js/controllers/preferencesAltCurrency.js
@@ -1,39 +1,31 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesAltCurrencyController',
- function($scope, $timeout, $log, configService, rateService, lodash, go, profileService, walletService) {
- this.hideAdv = true;
- this.hidePriv = true;
- this.hideSecret = true;
- this.error = null;
- this.success = null;
+ function($scope, $log, configService, rateService, lodash, go, profileService, walletService) {
var config = configService.getSync();
- this.selectedAlternative = {
+ $scope.currentCurrency = {
name: config.wallet.settings.alternativeName,
isoCode: config.wallet.settings.alternativeIsoCode
};
- this.alternativeOpts = [this.selectedAlternative]; //default value
-
- var self = this;
rateService.whenAvailable(function() {
- self.alternativeOpts = rateService.listAlternatives();
- lodash.remove(self.alternativeOpts, function(n) {
- return n.isoCode == 'BTC';
+ $scope.altCurrencyList = rateService.listAlternatives();
+
+ lodash.remove($scope.altCurrencyList, function(c) {
+ return c.isoCode == 'BTC';
+ });
+
+ lodash.each($scope.altCurrencyList, function(altCurrency) {
+ if (config.wallet.settings.alternativeIsoCode === altCurrency.isoCode)
+ $scope.currentCurrency = altCurrency;
});
- for (var ii in self.alternativeOpts) {
- if (config.wallet.settings.alternativeIsoCode === self.alternativeOpts[ii].isoCode) {
- self.selectedAlternative = self.alternativeOpts[ii];
- }
- }
$scope.$digest();
});
-
- this.save = function(newAltCurrency) {
+ $scope.save = function(newAltCurrency) {
var opts = {
wallet: {
settings: {
@@ -42,23 +34,14 @@ angular.module('copayApp.controllers').controller('preferencesAltCurrencyControl
}
}
};
- this.selectedAlternative = {
- name: newAltCurrency.name,
- isoCode: newAltCurrency.isoCode,
- };
configService.set(opts, function(err) {
if (err) $log.warn(err);
go.preferencesGlobal();
$scope.$emit('Local/UnitSettingUpdated');
- walletService.updateRemotePreferences(profileService.walletClients, {}, function() {
+ walletService.updateRemotePreferences(profileService.getClients(), {}, function() {
$log.debug('Remote preferences saved');
});
- $timeout(function() {
- $scope.$apply();
- }, 100);
});
};
-
-
});