angularjs digest errors fixed

This commit is contained in:
Mario Colque 2014-05-26 10:46:05 -03:00
parent f8246563a5
commit bc11fa7493
3 changed files with 26 additions and 21 deletions

View File

@ -489,9 +489,8 @@
</div> </div>
<div class="large-12 columns"> <div class="large-12 columns">
<h4>Last transactions</h4> <h4>Last transactions</h4>
<button ng-click="toogleLast()" ng-disabled="loading" loading="Updating"> <button ng-click="toogleLast()" ng-disabled="loading" loading="Updating" ng-hide="lastShowed && !loading">Show</button>
Show <button ng-click="toogleLast()" ng-disabled="loading" loading="Updating" ng-show="lastShowed && !loading">Hide</button>
</button>
<div class="btransactions" ng-if="lastShowed"> <div class="btransactions" ng-if="lastShowed">
<div ng-if="!blockchain_txs[0].txid && !loading"> <div ng-if="!blockchain_txs[0].txid && !loading">
No transactions yet. No transactions yet.
@ -511,7 +510,7 @@
</div> </div>
<div class="tx-copayers"> <div class="tx-copayers">
<div class="large-5 columns"> <div class="large-5 columns">
<div ng-repeat="vin in btx.vin | groupByAddress"> <div ng-repeat="vin in btx.vin track by $index | groupByAddress">
<p class="left text-gray size-12"> {{vin.addr}} </p> <p class="left text-gray size-12"> {{vin.addr}} </p>
<small class="right">{{vin.value}}</small> <small class="right">{{vin.value}}</small>
</div> </div>

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copay.transactions').controller('TransactionsController', angular.module('copay.transactions').controller('TransactionsController',
function($scope, $rootScope, controllerUtils) { function($scope, $rootScope, $timeout, controllerUtils) {
$scope.title = 'Transactions'; $scope.title = 'Transactions';
$scope.loading = false; $scope.loading = false;
@ -31,21 +31,21 @@ angular.module('copay.transactions').controller('TransactionsController',
}; };
$scope.toogleLast = function () { $scope.toogleLast = function () {
console.log('[toogleLast]'); $scope.loading = true;
$scope.loading=true;
$scope.lastShowed = !$scope.lastShowed; $scope.lastShowed = !$scope.lastShowed;
if ($scope.lastShowed) { if ($scope.lastShowed) {
$scope.getTransactions(function(txs){ $scope.getTransactions(function(txs){
$scope.loading=false; $timeout(function() {
$scope.blockchain_txs = txs; $scope.loading = false;
$rootScope.$digest(); $scope.blockchain_txs = txs;
$scope.$digest();
}, 10);
}); });
} } else {
else { $timeout(function(){
setTimeout(function(){ $scope.loading = false;
$scope.loading=false;
$rootScope.$digest(); $rootScope.$digest();
}); }, 10);
} }
}; };
@ -90,7 +90,6 @@ angular.module('copay.transactions').controller('TransactionsController',
$scope.getTransactions = function(cb) { $scope.getTransactions = function(cb) {
var w =$rootScope.wallet; var w =$rootScope.wallet;
if (w) { if (w) {
console.log('### Querying last transactions...'); //TODO console.log('### Querying last transactions...'); //TODO
var addresses = w.getAddressesStr(); var addresses = w.getAddressesStr();
if (addresses.length > 0) { if (addresses.length > 0) {

View File

@ -14,15 +14,22 @@ angular.module('copay.filters', [])
return dic; return dic;
} }
var dic = inputs.reduce(reduce, {}); var dic;
return Object.keys(dic).map(function(key) { if (inputs) {
return { addr: key, value: dic[key] }; dic = inputs.reduce(reduce, {});
}); return Object.keys(dic).map(function(key) {
return { addr: key, value: dic[key] };
});
}
}; };
}) })
.filter('paged', function() { .filter('paged', function() {
return function(elements) { return function(elements) {
return elements.filter(Boolean); if (elements) {
return elements.filter(Boolean);
}
return false;
}; };
}) })
.filter('limitAddress', function() { .filter('limitAddress', function() {