diff --git a/index.html b/index.html index 6e32d827c..16ff447b1 100644 --- a/index.html +++ b/index.html @@ -67,10 +67,10 @@ -
+
-
- {{$root.flashMessage.message}} +
+ {{$root.$flashMessage.message}} ×
diff --git a/js/controllers/header.js b/js/controllers/header.js index 4d43919ef..ae5d7eed6 100644 --- a/js/controllers/header.js +++ b/js/controllers/header.js @@ -50,7 +50,7 @@ angular.module('copay.header').controller('HeaderController', }; $scope.clearFlashMessage = function() { - $rootScope.flashMessage = {}; + $rootScope.$flashMessage = {}; }; $rootScope.isCollapsed = true; diff --git a/js/controllers/import.js b/js/controllers/import.js index 118407eac..612c4d8ad 100644 --- a/js/controllers/import.js +++ b/js/controllers/import.js @@ -23,7 +23,7 @@ angular.module('copay.import').controller('ImportController', $scope.import = function(form) { if (form.$invalid) { - $rootScope.flashMessage = { message: 'There is an error in the form. Please, try again', type: 'error'}; + $rootScope.$flashMessage = { message: 'There is an error in the form. Please, try again', type: 'error'}; return; } @@ -32,7 +32,7 @@ angular.module('copay.import').controller('ImportController', var password = form.password.$modelValue; if (!backupFile && !backupText) { - $rootScope.flashMessage = { message: 'Please, select your backup file or paste the text', type: 'error'}; + $rootScope.$flashMessage = { message: 'Please, select your backup file or paste the text', type: 'error'}; return; } diff --git a/js/controllers/send.js b/js/controllers/send.js index 7658f3dad..07bbfbb53 100644 --- a/js/controllers/send.js +++ b/js/controllers/send.js @@ -42,7 +42,7 @@ angular.module('copay.send').controller('SendController', $scope.submitForm = function(form) { if (form.$invalid) { - $rootScope.flashMessage = { message: 'You can not send a proposal transaction. Please, try again', type: 'error'}; + $rootScope.$flashMessage = { message: 'You can not send a proposal transaction. Please, try again', type: 'error'}; return; } @@ -55,7 +55,7 @@ angular.module('copay.send').controller('SendController', w.createTx( address, amount,function() { $scope.loading = false; - $rootScope.flashMessage = { message: 'The transaction proposal has been created', type: 'success'}; + $rootScope.$flashMessage = { message: 'The transaction proposal has been created', type: 'success'}; $rootScope.$digest(); }); diff --git a/js/controllers/setup.js b/js/controllers/setup.js index a08971cf2..4f8030434 100644 --- a/js/controllers/setup.js +++ b/js/controllers/setup.js @@ -35,7 +35,7 @@ angular.module('copay.setup').controller('SetupController', $scope.create = function(form) { if (form && form.$invalid) { - $rootScope.flashMessage = { message: 'Please, enter required fields', type: 'error'}; + $rootScope.$flashMessage = { message: 'Please, enter required fields', type: 'error'}; return; } $scope.loading = true; diff --git a/js/controllers/signin.js b/js/controllers/signin.js index 1538cd8a6..2513784ad 100644 --- a/js/controllers/signin.js +++ b/js/controllers/signin.js @@ -14,7 +14,7 @@ angular.module('copay.signin').controller('SigninController', $scope.create = function(form) { if (form && form.$invalid) { - $rootScope.flashMessage = { message: 'Please, enter required fields', type: 'error'}; + $rootScope.$flashMessage = { message: 'Please, enter required fields', type: 'error'}; return; } @@ -27,7 +27,7 @@ angular.module('copay.signin').controller('SigninController', $scope.open = function(form) { if (form && form.$invalid) { - $rootScope.flashMessage = { message: 'Please, enter required fields', type: 'error'}; + $rootScope.$flashMessage = { message: 'Please, enter required fields', type: 'error'}; return; } @@ -40,7 +40,7 @@ angular.module('copay.signin').controller('SigninController', var w = walletFactory.open($scope.selectedWalletId, { passphrase: passphrase}); if (!w) { $scope.loading = $scope.failure = false; - $rootScope.flashMessage = { message: 'Bad password or connection error', type: 'error'}; + $rootScope.$flashMessage = { message: 'Bad password or connection error', type: 'error'}; $rootScope.$digest(); return; } @@ -53,7 +53,7 @@ angular.module('copay.signin').controller('SigninController', $scope.join = function(form) { if (form && form.$invalid) { - $rootScope.flashMessage = { message: 'Please, enter required fields', type: 'error'}; + $rootScope.$flashMessage = { message: 'Please, enter required fields', type: 'error'}; return; } @@ -66,13 +66,13 @@ angular.module('copay.signin').controller('SigninController', $scope.loading = false; if (err || !w) { if (err === 'joinError') - $rootScope.flashMessage = { message: 'Can not find peer'}; + $rootScope.$flashMessage = { message: 'Can not find peer'}; else if (err === 'walletFull') - $rootScope.flashMessage = { message: 'The wallet is full'}; + $rootScope.$flashMessage = { message: 'The wallet is full', type: 'error'}; else if (err === 'badSecret') - $rootScope.flashMessage = { message: 'Bad secret secret string', type: 'error'}; + $rootScope.$flashMessage = { message: 'Bad secret secret string', type: 'error'}; else - $rootScope.flashMessage = { message: 'Unknown error', type: 'error'}; + $rootScope.$flashMessage = { message: 'Unknown error', type: 'error'}; controllerUtils.onErrorDigest(); } else { controllerUtils.startNetwork(w); diff --git a/js/controllers/transactions.js b/js/controllers/transactions.js index a8e1062b7..2094c2d4c 100644 --- a/js/controllers/transactions.js +++ b/js/controllers/transactions.js @@ -47,7 +47,7 @@ angular.module('copay.transactions').controller('TransactionsController', var w = $rootScope.wallet; w.sendTx(ntxid, function(txid) { console.log('[transactions.js.68:txid:] SENTTX CALLBACK',txid); //TODO - $rootScope.flashMessage = txid + $rootScope.$flashMessage = txid ? {type:'success', message: 'Transaction broadcasted. txid: ' + txid} : {type:'error', message: 'There was an error sending the Transaction'} ; @@ -61,7 +61,7 @@ angular.module('copay.transactions').controller('TransactionsController', var w = $rootScope.wallet; w.sign(ntxid, function(ret){ if (!ret) { - $rootScope.flashMessage = { + $rootScope.$flashMessage = { type:'error', message: 'There was an error signing the Transaction', }; @@ -101,7 +101,7 @@ angular.module('copay.transactions').controller('TransactionsController', $rootScope.txAlertCount = 0; var w = $rootScope.wallet; w.reject(ntxid); - $rootScope.flashMessage = {type:'warning', message: 'Transaction rejected by you'}; + $rootScope.$flashMessage = {type:'warning', message: 'Transaction rejected by you'}; $scope.loading = false; }; diff --git a/js/directives.js b/js/directives.js index cefb4bbc4..606c5e9c9 100644 --- a/js/directives.js +++ b/js/directives.js @@ -30,7 +30,7 @@ angular.module('copay.directives') link: function(scope, element, attrs, ctrl) { setTimeout(function() { scope.$apply(function() { - $rootScope.flashMessage = {}; + $rootScope.$flashMessage = {}; }); }, 5000); } diff --git a/js/services/controllerUtils.js b/js/services/controllerUtils.js index 56f87fc00..dc85a032a 100644 --- a/js/services/controllerUtils.js +++ b/js/services/controllerUtils.js @@ -19,7 +19,7 @@ angular.module('copay.controllerUtils') video.close(); // Clear rootScope for (var i in $rootScope) { - if (i.charAt(0) != '$' && i != 'flashMessage') { + if (i.charAt(0) != '$') { delete $rootScope[i]; } } @@ -50,7 +50,7 @@ angular.module('copay.controllerUtils') $rootScope.$digest(); }; w.on('badMessage', function(peerId) { - $rootScope.flashMessage = { + $rootScope.$flashMessage = { type: 'error', message: 'Received wrong message from peer id:' + peerId };