Autofocus and show the second PIN input automatically. Hide submit button. Allow only numbers
This commit is contained in:
parent
33e0bf80a6
commit
51028178ed
3 changed files with 96 additions and 28 deletions
|
|
@ -43,6 +43,45 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc
|
|||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty($scope,
|
||||
"newpin", {
|
||||
get: function() {
|
||||
return this._newpin;
|
||||
},
|
||||
set: function(newValue) {
|
||||
this._newpin = newValue;
|
||||
if (newValue && newValue.length == 4) {
|
||||
// next input
|
||||
$scope.$$childTail.secondPin = true;
|
||||
}
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty($scope,
|
||||
"repeatpin", {
|
||||
get: function() {
|
||||
return this._repeatpin;
|
||||
},
|
||||
set: function(newValue) {
|
||||
this._repeatpin = newValue;
|
||||
if (newValue && newValue.length == 4) {
|
||||
if ($scope.$$childTail._newpin === newValue) {
|
||||
// save and submit
|
||||
$scope.createPin($scope.$$childTail.setPinForm);
|
||||
}
|
||||
else {
|
||||
$scope.error = 'Pin must match!';
|
||||
}
|
||||
}
|
||||
if (!newValue) {
|
||||
$scope.error = null;
|
||||
}
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
$scope.done = function() {
|
||||
$rootScope.starting = false;
|
||||
|
|
|
|||
|
|
@ -286,10 +286,20 @@ angular.module('copayApp.directives')
|
|||
link: function(_scope, _element) {
|
||||
$timeout(function() {
|
||||
_element[0].focus();
|
||||
}, 0);
|
||||
});
|
||||
}
|
||||
};
|
||||
})
|
||||
.directive('showFocus', function($timeout) {
|
||||
return function(scope, element, attrs) {
|
||||
scope.$watch(attrs.showFocus,
|
||||
function (newValue) {
|
||||
$timeout(function() {
|
||||
newValue && element[0].focus();
|
||||
});
|
||||
},true);
|
||||
};
|
||||
})
|
||||
.directive('match', function() {
|
||||
return {
|
||||
require: 'ngModel',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue