Fix amount input (angular directive)

This commit is contained in:
Gustavo Maximiliano Cortez 2014-12-02 17:06:22 -03:00 committed by bechi
commit 29f4e91423
2 changed files with 3 additions and 4 deletions

View file

@ -91,15 +91,14 @@ angular.module('copayApp.directives')
])
.directive('validAmount', ['$rootScope', '$locale',
function($rootScope, locale) {
var w = $rootScope.wallet;
preconditions.checkState(w);
preconditions.checkState(w.settings.unitToSatoshi);
var formats = locale.NUMBER_FORMATS;
return {
require: 'ngModel',
link: function(scope, element, attrs, ctrl) {
var val = function(value) {
var w = $rootScope.wallet;
preconditions.checkState(w);
var vNum = Number((value * w.settings.unitToSatoshi).toFixed(0));
if (typeof value == 'undefined') {

View file

@ -88,7 +88,7 @@
<input type="number" id="amount"
ng-disabled="loading || ($root.merchant && +$root.merchant.total > 0) || isPayUri"
name="amount" placeholder="{{'Amount'|translate}}" ng-model="amount"
min="0.00000001" max="10000000000" valid-amount required
ng-minlength="0.00000001" ng-maxlength="10000000000" valid-amount required
autocomplete="off">
<i class="icon-bitcoin"></i>
</div>