make wallet selector a standalone directive
This commit is contained in:
parent
d726b39b47
commit
ec3fca4cda
8 changed files with 132 additions and 102 deletions
|
|
@ -113,16 +113,11 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
});
|
||||
|
||||
$scope.showWalletSelector = function() {
|
||||
console.log('showWalletSelector called');
|
||||
console.log('$scope.wallets', $scope.wallets);
|
||||
$scope.showWallets = true;
|
||||
};
|
||||
|
||||
$scope.selectWallet = function(w) {
|
||||
$timeout(function() {
|
||||
$scope.showWallets = false;
|
||||
}, 100);
|
||||
setWallet(w);
|
||||
$scope.onWalletSelect = function(wallet) {
|
||||
setWallet(wallet);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -10,11 +10,6 @@ angular.module('copayApp.directives')
|
|||
show: '=actionSheetShow',
|
||||
},
|
||||
link: function(scope, element, attrs) {
|
||||
console.log('action sheet instantiated');
|
||||
scope.$watch('show', function() {
|
||||
console.log('show called', scope.show);
|
||||
});
|
||||
|
||||
scope.hide = function() {
|
||||
scope.show = false;
|
||||
};
|
||||
|
|
|
|||
27
src/js/directives/walletSelector.js
Normal file
27
src/js/directives/walletSelector.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.directives')
|
||||
.directive('walletSelector', function($timeout) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
templateUrl: 'views/includes/walletSelector.html',
|
||||
transclude: true,
|
||||
scope: {
|
||||
show: '=walletSelectorShow',
|
||||
wallets: '=walletSelectorWallets',
|
||||
selectedWallet: '=walletSelectorSelectedWallet',
|
||||
onSelect: '=walletSelectorOnSelect'
|
||||
},
|
||||
link: function(scope, element, attrs) {
|
||||
scope.hide = function() {
|
||||
scope.show = false;
|
||||
};
|
||||
scope.selectWallet = function(wallet) {
|
||||
$timeout(function() {
|
||||
scope.hide();
|
||||
}, 100);
|
||||
scope.onSelect(wallet);
|
||||
};
|
||||
}
|
||||
};
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue