Wallet/src/js/directives/incomingDataMenu.js

38 lines
1.3 KiB
JavaScript
Raw Normal View History

2016-10-13 18:29:03 -04:00
'use strict';
angular.module('copayApp.directives')
.directive('incomingDataMenu', function($timeout, $rootScope, $state) {
2016-10-13 18:29:03 -04:00
return {
restrict: 'E',
templateUrl: 'views/includes/incomingDataMenu.html',
link: function(scope, element, attrs) {
$rootScope.$on('incomingDataMenu.showMenu', function(event, data) {
2016-10-14 15:21:16 -04:00
$timeout(function() {
scope.data = data.data;
scope.type = data.type;
2016-10-14 15:21:16 -04:00
scope.showMenu = true;
console.log('data', data);
2016-10-14 15:21:16 -04:00
});
});
2016-10-14 15:54:20 -04:00
scope.hide = function() {
scope.showMenu = false;
$rootScope.$broadcast('incomingDataMenu.menuHidden');
2016-10-14 15:54:20 -04:00
};
scope.sendPaymentToAddress = function(bitcoinAddress) {
scope.showMenu = false;
2016-10-18 17:23:43 -04:00
$state.go('tabs.send').then(function() {
$state.transitionTo('tabs.send.amount', {toAddress: bitcoinAddress});
2016-10-18 17:23:43 -04:00
});
};
2016-10-18 16:36:47 -04:00
scope.addToAddressBook = function(bitcoinAddress) {
scope.showMenu = false;
2016-10-18 16:36:47 -04:00
$timeout(function() {
2016-10-18 17:23:43 -04:00
$state.go('tabs.send').then(function() {
$state.transitionTo('tabs.send.addressbook', {addressbookEntry: bitcoinAddress});
});
2016-10-18 16:36:47 -04:00
}, 100);
};
2016-10-13 18:29:03 -04:00
}
};
});