Fix amount input (angular directive)
This commit is contained in:
parent
871099c9c1
commit
29f4e91423
2 changed files with 3 additions and 4 deletions
|
|
@ -91,15 +91,14 @@ angular.module('copayApp.directives')
|
||||||
])
|
])
|
||||||
.directive('validAmount', ['$rootScope', '$locale',
|
.directive('validAmount', ['$rootScope', '$locale',
|
||||||
function($rootScope, locale) {
|
function($rootScope, locale) {
|
||||||
var w = $rootScope.wallet;
|
|
||||||
preconditions.checkState(w);
|
|
||||||
preconditions.checkState(w.settings.unitToSatoshi);
|
|
||||||
var formats = locale.NUMBER_FORMATS;
|
var formats = locale.NUMBER_FORMATS;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
require: 'ngModel',
|
require: 'ngModel',
|
||||||
link: function(scope, element, attrs, ctrl) {
|
link: function(scope, element, attrs, ctrl) {
|
||||||
var val = function(value) {
|
var val = function(value) {
|
||||||
|
var w = $rootScope.wallet;
|
||||||
|
preconditions.checkState(w);
|
||||||
var vNum = Number((value * w.settings.unitToSatoshi).toFixed(0));
|
var vNum = Number((value * w.settings.unitToSatoshi).toFixed(0));
|
||||||
|
|
||||||
if (typeof value == 'undefined') {
|
if (typeof value == 'undefined') {
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@
|
||||||
<input type="number" id="amount"
|
<input type="number" id="amount"
|
||||||
ng-disabled="loading || ($root.merchant && +$root.merchant.total > 0) || isPayUri"
|
ng-disabled="loading || ($root.merchant && +$root.merchant.total > 0) || isPayUri"
|
||||||
name="amount" placeholder="{{'Amount'|translate}}" ng-model="amount"
|
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">
|
autocomplete="off">
|
||||||
<i class="icon-bitcoin"></i>
|
<i class="icon-bitcoin"></i>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue