Addressbook as a view (not modal)
This commit is contained in:
parent
c6e459add3
commit
32d99e3e36
14 changed files with 330 additions and 237 deletions
36
src/js/controllers/addressbookAdd.js
Normal file
36
src/js/controllers/addressbookAdd.js
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('addressbookAddController', function($scope, $state, $timeout, addressbookService, popupService) {
|
||||
|
||||
$scope.addressbookEntry = {
|
||||
'address': '',
|
||||
'name': '',
|
||||
'email': ''
|
||||
};
|
||||
|
||||
$scope.onQrCodeScanned = function(data, addressbookForm) {
|
||||
$timeout(function() {
|
||||
var form = addressbookForm;
|
||||
if (data && form) {
|
||||
data = data.replace('bitcoin:', '');
|
||||
form.address.$setViewValue(data);
|
||||
form.address.$isValid = true;
|
||||
form.address.$render();
|
||||
}
|
||||
$scope.$digest();
|
||||
}, 100);
|
||||
};
|
||||
|
||||
$scope.add = function(addressbook) {
|
||||
$timeout(function() {
|
||||
addressbookService.add(addressbook, function(err, ab) {
|
||||
if (err) {
|
||||
popupService.showAlert(err);
|
||||
return;
|
||||
}
|
||||
$state.go('tabs.addressbook');
|
||||
});
|
||||
}, 100);
|
||||
};
|
||||
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue