update option if enabled/disabled

This commit is contained in:
JDonadio 2017-03-02 11:25:38 -03:00
commit 34413278ec
3 changed files with 23 additions and 21 deletions

View file

@ -1,14 +1,12 @@
'use strict';
angular.module('copayApp.controllers').controller('pincodeController', function($timeout, $scope, $log, $window, configService) {
angular.module('copayApp.controllers').controller('pincodeController', function($rootScope, $timeout, $scope, $log, $window, configService) {
var config = configService.getSync();
$scope.currentPincode = config.pincode ? config.pincode.value : null;
$scope.pincode = $scope.pc1 = $scope.pc2 = '';
console.log('#######', $scope.from, $scope.enabled);
$scope.pincode = $scope.pc1 = $scope.pc2 = null;
angular.element($window).on('keydown', function(e) {
if (e.which === 8) { // you can add others here inside brackets.
if (e.which === 8) {
e.preventDefault();
$scope.delete();
}
@ -16,7 +14,7 @@ angular.module('copayApp.controllers').controller('pincodeController', function(
if (e && e.key.match(/^[0-9]$/))
$scope.add(e.key);
else if (e && e.keyCode == 27)
$scope.close(false);
$scope.cancel();
else if (e && e.keyCode == 13)
$scope.save();
});
@ -70,4 +68,9 @@ angular.module('copayApp.controllers').controller('pincodeController', function(
$scope.close = function() {
$scope.pincodeModal.hide();
};
$scope.cancel = function() {
$rootScope.$emit('updatePincodeOption', false);
$scope.close();
};
});