Addressbook as a view (not modal)
This commit is contained in:
parent
c6e459add3
commit
32d99e3e36
14 changed files with 330 additions and 237 deletions
37
src/js/controllers/addressbookView.js
Normal file
37
src/js/controllers/addressbookView.js
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('addressbookViewController', function($scope, $state, $timeout, $stateParams, lodash, addressbookService, popupService) {
|
||||
|
||||
var address = $stateParams.address;
|
||||
|
||||
if (!address) {
|
||||
$state.go('tabs.addressbook');
|
||||
return;
|
||||
}
|
||||
|
||||
addressbookService.get(address, function(err, obj) {
|
||||
if (err) {
|
||||
popupService.showAlert(err);
|
||||
return;
|
||||
}
|
||||
if (!lodash.isObject(obj)) {
|
||||
var name = obj;
|
||||
obj = {
|
||||
'name': name,
|
||||
'address': address,
|
||||
'email': ''
|
||||
};
|
||||
}
|
||||
$scope.addressbookEntry = obj;
|
||||
});
|
||||
|
||||
$scope.sendTo = function() {
|
||||
$timeout(function() {
|
||||
$state.transitionTo('send.amount', {
|
||||
toAddress: $scope.addressbookEntry.address,
|
||||
toName: $scope.addressbookEntry.name
|
||||
});
|
||||
}, 100);
|
||||
};
|
||||
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue