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 class="large-12 columns">
<h4>Last transactions</h4>
<button ng-click="toogleLast()" ng-disabled="loading" loading="Updating">
Show
</button>
<button ng-click="toogleLast()" ng-disabled="loading" loading="Updating" ng-hide="lastShowed && !loading">Show</button>
<button ng-click="toogleLast()" ng-disabled="loading" loading="Updating" ng-show="lastShowed && !loading">Hide</button>
<div class="btransactions" ng-if="lastShowed">
<div ng-if="!blockchain_txs[0].txid && !loading">
No transactions yet.
@ -511,7 +510,7 @@
</div>
<div class="tx-copayers">
<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>
<small class="right">{{vin.value}}</small>
</div>

View File

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

View File

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