Fix Addressbook
This commit is contained in:
parent
d87f27a8e0
commit
17a70c1d50
2 changed files with 24 additions and 9 deletions
|
|
@ -534,7 +534,8 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
};
|
||||
|
||||
$scope.cancel = function(form) {
|
||||
$scope.error = $scope.success = null;
|
||||
$scope.error = $scope.success = $scope.newaddress = $scope.newlabel = null;
|
||||
clearForm(form);
|
||||
$scope.toggleForm();
|
||||
};
|
||||
|
||||
|
|
@ -542,11 +543,23 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
$scope.showForm = !$scope.showForm;
|
||||
};
|
||||
|
||||
var clearForm = function(form) {
|
||||
form.newaddress.$pristine = true;
|
||||
form.newaddress.$setViewValue('');
|
||||
form.newaddress.$render();
|
||||
|
||||
form.newlabel.$pristine = true;
|
||||
form.newlabel.$setViewValue('');
|
||||
form.newlabel.$render();
|
||||
form.$setPristine();
|
||||
};
|
||||
|
||||
// TODO change to modal
|
||||
$scope.submitAddressBook = function(form) {
|
||||
if (form.$invalid) {
|
||||
return;
|
||||
}
|
||||
$scope.loading = true;
|
||||
$timeout(function() {
|
||||
var errorMsg;
|
||||
var entry = {
|
||||
|
|
@ -563,11 +576,13 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
if (errorMsg) {
|
||||
$scope.error = errorMsg;
|
||||
} else {
|
||||
clearForm(form);
|
||||
$scope.toggleForm();
|
||||
notification.success('Entry created', 'New addressbook entry created')
|
||||
}
|
||||
$scope.loading = false;
|
||||
$rootScope.$digest();
|
||||
}, 1);
|
||||
}, 100);
|
||||
return;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue