Wallet/src/js/directives/incomingDataMenu.js

42 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;
};
scope.sendPaymentToAddress = function(bitcoinAddress) {
scope.hide();
$state.go('tabs.send');
$timeout(function() {
$state.transitionTo('tabs.send.amount', {toAddress: bitcoinAddress});
}, 100);
};
2016-10-18 16:36:47 -04:00
scope.addToAddressBook = function(bitcoinAddress) {
scope.hide();
$state.go('tabs.send');
$timeout(function() {
$state.transitionTo('tabs.send.addressbook', {addressbookEntry: bitcoinAddress});
}, 100);
};
scope.$watch('showMenu', function() {
if(!scope.showMenu) {
$rootScope.$broadcast('incomingDataMenu.menuHidden');
}
});
2016-10-13 18:29:03 -04:00
}
};
});