add timeout to fix settings saving

This commit is contained in:
Matias Alejo Garcia 2014-12-11 23:45:44 -03:00
commit 3210c87ec1
2 changed files with 6 additions and 3 deletions

View file

@ -160,6 +160,7 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun
$scope.error = 'Please enter the required fields';
return;
}
$scope.saveSettings(function(err) {
preconditions.checkState(!err, err);

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.services').factory('configService', function(localstorageService, gettextCatalog) {
angular.module('copayApp.services').factory('configService', function($timeout, localstorageService, gettextCatalog) {
var root = {};
root.set = function(opts, cb) {
@ -22,10 +22,12 @@ angular.module('copayApp.services').factory('configService', function(localstora
var newOpts = {};
_.extend(newOpts, copay.defaultConfig, oldOpts, opts);
// TODO remove this gloval variable.
// TODO remove this global variable.
config = newOpts;
localstorageService.setItem('config', JSON.stringify(newOpts), cb);
localstorageService.setItem('config', JSON.stringify(newOpts), function() {
$timeout(cb, 1);
});
});
};