remove temporary vars

This commit is contained in:
Esteban Ordano 2014-08-27 17:19:28 -03:00
parent 3225553d78
commit 0f0e7b78d5
2 changed files with 7 additions and 17 deletions

View File

@ -6,12 +6,9 @@ angular.module('copayApp.controllers').controller('SendController',
$scope.title = 'Send';
$scope.loading = false;
var satToUnit = 1 / config.unitToSatoshi;
var configAlternativeToSatoshi = (1 / 512 / 1e-8);
var satToAlternative = 1 / configAlternativeToSatoshi; // TODO: Change
$scope.defaultFee = bitcore.TransactionBuilder.FEE_PER_1000B_SAT * satToUnit;
$scope.unitToBtc = config.unitToSatoshi / bitcore.util.COIN;
$scope.minAmount = config.limits.minAmountSatoshi * satToUnit;
$scope.minAlternativeAmount = config.limits.minAmountSatoshi * satToAlternative;
this.alternativeName = config.alternativeName;
this.alternativeIsoCode = config.alternativeIsoCode;
@ -19,16 +16,9 @@ angular.module('copayApp.controllers').controller('SendController',
$scope._amount = 0;
$scope._alternative = 0;
this.amountFilter = function(val) {
if (val) {
return val.toFixed(config.unitDecimals);
}
var makeNumber = function(val) {
return -(-val);
};
this.fiatFilter = function(val) {
if (val) {
return val.toFixed(2);
}
}
Object.defineProperty($scope,
"alternative", {
@ -38,8 +28,8 @@ angular.module('copayApp.controllers').controller('SendController',
set: function (newValue) {
this._alternative = newValue;
if (typeof(newValue) === 'number') {
this._amount = -(-(
rateService.fromFiat(newValue, config.alternativeIsoCode) * satToUnit
this._amount = makeNumber(
(rateService.fromFiat(newValue, config.alternativeIsoCode) * satToUnit
).toFixed(config.unitDecimals));
}
},
@ -54,8 +44,8 @@ angular.module('copayApp.controllers').controller('SendController',
set: function (newValue) {
this._amount = newValue;
if (newValue) {
this._alternative = -(-(
rateService.toFiat(newValue * config.unitToSatoshi, config.alternativeIsoCode)
this._alternative = makeNumber(
(rateService.toFiat(newValue * config.unitToSatoshi, config.alternativeIsoCode)
).toFixed(2));
}
},

View File

@ -90,7 +90,7 @@
<input type="number" id="alternative_amount"
ng-disabled="loading || !ctrl.rateService.isAvailable "
name="alternative" placeholder="Amount" ng-model="alternative"
min="{{minAlternativeAmount}}" max="10000000000" enough-amount required
enough-amount required
autocomplete="off"
>
</div>