scroll up in forms
This commit is contained in:
parent
736056fd20
commit
97013ea5b6
7 changed files with 48 additions and 33 deletions
|
|
@ -1,13 +1,12 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('createController',
|
||||
function($scope, $location, $anchorScroll, $rootScope, $timeout, $log, lodash, go, profileService, configService, gettext, ledger, trezor, platformInfo, derivationPathHelper) {
|
||||
function($scope, $ionicScrollDelegate, $rootScope, $timeout, $log, lodash, go, profileService, configService, gettext, ledger, trezor, platformInfo, derivationPathHelper) {
|
||||
|
||||
var isChromeApp = platformInfo.isChromeApp;
|
||||
var isCordova = platformInfo.isCordova;
|
||||
var isDevel = platformInfo.isDevel;
|
||||
|
||||
|
||||
var self = this;
|
||||
var defaults = configService.getDefaults();
|
||||
this.isWindowsPhoneApp = platformInfo.isWP && isCordova;
|
||||
|
|
@ -90,6 +89,7 @@ angular.module('copayApp.controllers').controller('createController',
|
|||
this.create = function(form) {
|
||||
if (form && form.$invalid) {
|
||||
this.error = gettext('Please enter the required fields');
|
||||
$ionicScrollDelegate.scrollTop();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -116,6 +116,7 @@ angular.module('copayApp.controllers').controller('createController',
|
|||
var pathData = derivationPathHelper.parse($scope.derivationPath);
|
||||
if (!pathData) {
|
||||
this.error = gettext('Invalid derivation path');
|
||||
$ionicScrollDelegate.scrollTop();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -129,6 +130,7 @@ angular.module('copayApp.controllers').controller('createController',
|
|||
|
||||
if (setSeed && !opts.mnemonic && !opts.extendedPrivateKey) {
|
||||
this.error = gettext('Please enter the wallet recovery phrase');
|
||||
$ionicScrollDelegate.scrollTop();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -136,6 +138,7 @@ angular.module('copayApp.controllers').controller('createController',
|
|||
var account = $scope.account;
|
||||
if (!account || account < 1) {
|
||||
this.error = gettext('Invalid account number');
|
||||
$ionicScrollDelegate.scrollTop();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -150,6 +153,7 @@ angular.module('copayApp.controllers').controller('createController',
|
|||
self.hwWallet = false;
|
||||
if (err) {
|
||||
self.error = err;
|
||||
$ionicScrollDelegate.scrollTop();
|
||||
$scope.$apply();
|
||||
return;
|
||||
}
|
||||
|
|
@ -170,7 +174,7 @@ angular.module('copayApp.controllers').controller('createController',
|
|||
if (err) {
|
||||
$log.warn(err);
|
||||
self.error = err;
|
||||
scrollUp('notification');
|
||||
$ionicScrollDelegate.scrollTop();
|
||||
$timeout(function() {
|
||||
$rootScope.$apply();
|
||||
});
|
||||
|
|
@ -182,12 +186,6 @@ angular.module('copayApp.controllers').controller('createController',
|
|||
}, 100);
|
||||
}
|
||||
|
||||
function scrollUp(location) {
|
||||
if (!location) return;
|
||||
$location.hash(location);
|
||||
$anchorScroll();
|
||||
};
|
||||
|
||||
this.formFocus = function(what) {
|
||||
if (!this.isWindowsPhoneApp) return
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue