feature(tour): fetch USDBTC rate for tour graphic

This commit is contained in:
Jason Dreyzehner 2016-10-04 23:42:39 -04:00
parent 0c0ccbd105
commit 6efb17515a
2 changed files with 10 additions and 2 deletions

View File

@ -30,7 +30,7 @@
<h2 class="onboarding-topic" translate>Bitcoin is a currency.</h2>
<p class="onboarding-description" translate>You can trade it for other currencies like US Dollars, Euros, or Pounds.</p>
<div class="onboarding-illustration-currency">
<div id="onboarding-illustration-currency-exchange-rate">1 BTC = $1,000</div>
<div id="onboarding-illustration-currency-exchange-rate">1 BTC = {{localCurrencySymbol}}{{localCurrencyPerBtc}}</div>
</div>
<div class="cta-buttons">
<p class="onboarding-tldr" translate>The exchange rate changes with the market.</p>

View File

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('tourController',
function($scope, $state, $log, $timeout, ongoingProcess, profileService) {
function($scope, $state, $log, $timeout, $filter, ongoingProcess, profileService, rateService) {
var tries = 0;
@ -17,6 +17,14 @@ angular.module('copayApp.controllers').controller('tourController',
}
};
rateService.whenAvailable(function() {
var localCurrency = 'USD';
var btcAmount = 1;
var rate = rateService.toFiat(btcAmount * 1e8, localCurrency);
$scope.localCurrencySymbol = '$';
$scope.localCurrencyPerBtc = $filter('formatFiatAmount')(parseFloat(rate.toFixed(2), 10));
});
$scope.createDefaultWallet = function() {
ongoingProcess.set('creatingWallet', true);
profileService.createDefaultWallet(function(err, walletClient) {