- Total crypto market $ {{totalCryptoMarket | number : fractionSize }}
- 24h volume ${{volume_24h | number : fractionSize }}>script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
- Bitcoin dominance {{bitcoinDominance}}%
- Value in USD ${{total | number:3}}
{{x.rank}}
|
$ {{x.price_usd }}
|
$ {{x.market_cap_usd | number : fractionSize }}
|
{{x.percent_change_24h}}%
|
{{x.percent_change_1h}}%
|
{{x.total_supply | number : fractionSize }}
|
$ {{x.24h_volume_usd | number : fractionSize}}
|
|
$ {{x.price_usd * num }}
|
var app = angular.module("ap",[]);
app.controller("con",function($scope , $http ,$location){ $scope.class = "col-xs-12"; $scope.changeClass = function() { if ($scope.class === "col-xs-12") $scope.class = "col-xs-10"; else $scope.class = "col-xs-12"; };
$scope.caltotal = function(){
var total = 0 $(".temp").each(function(a,b){ console.log(parseFloat(b.innerText)) total += parseFloat(b.innerText) }) $scope.total = total;
}
$scope.gap = 7; $scope.currentPage = 0;
function refresh(){ $http.get("https://api.coinmarketcap.com/v1/ticker/?limit=1000").then(function(response) {
var a=0; var b=0;
$scope.result = []; $scope.result.push([]);
angular.forEach(response.data, function (res) {
if(res.price_usd == null) { res.price_usd = 0; } if(res.price_btc == null) { res.price_btc = 0; } if(res['24h_volume_usd'] == null) { res['24h_volume_usd'] = 0; } if(res.market_cap_usd == null) { res.market_cap_usd = 0; } if(res.available_supply == null) { res.available_supply = 0; } if(res.total_supply == null) { res.total_supply = 0; } if(res.percent_change_1h == null) { res.percent_change_1h = 0; } if(res.percent_change_24h == null) { res.percent_change_24h = 0; } if(res.percent_change_7d == null) { res.percent_change_7d = 0; }
res.rank = parseInt(res.rank); res.price_usd = parseFloat(res.price_usd); res.price_btc = parseFloat(res.price_btc);
res['24h_volume_usd'] = parseFloat(res['24h_volume_usd']);
res.market_cap_usd = parseFloat(res.market_cap_usd); res.available_supply = parseFloat(res.available_supply); res.total_supply = parseFloat(res.total_supply); res.percent_change_1h = parseFloat(res.percent_change_1h); res.percent_change_24h = parseFloat(res.percent_change_24h); res.percent_change_7d = parseFloat(res.percent_change_7d); res.imgid = "https://files.coinmarketcap.com/static/img/coins/32x32/" + res.id + ".png";
if(b==49) {
a++; b=0; $scope.result.push([]); } else { b++; }
$scope.result[a].push(res);
});
$scope.pagedItems = a+1;
}); }
refresh(); refresh(); refresh(); setInterval( function () { refresh() } , 3000);
$scope.prevPage = function () { if ($scope.currentPage > 0) { $scope.currentPage--; } };
$scope.nextPage = function () {
if ($scope.currentPage < $scope.result.length - 1) {
$scope.currentPage++;
}
};
$scope.setPage = function (n) {
$scope.currentPage = n;
};
$scope.range = function (size,start, end) {
var ret = [];
if (size < end) {
end = size;
start = size-$scope.gap;
}
if(start > 2 && end < size-3)
{
start = start - 3;
end = end - 3;
}
for (var i = start; i < end; i++) {
ret.push(i);
}
return ret;
};
$http.get("https://api.coinmarketcap.com/v1/global/").then(function(response) {
$scope.totalCryptoMarket = response.data.total_market_cap_usd;
$scope.volume_24h = response.data.total_24h_volume_usd;
$scope.bitcoinDominance = response.data.bitcoin_percentage_of_market_cap;
});
});