Wallet/src/js/directives/slideToAcceptSuccess.js

40 lines
1.2 KiB
JavaScript
Raw Normal View History

2016-10-07 20:03:51 -04:00
'use strict';
angular.module('copayApp.directives')
2017-06-08 11:41:30 -03:00
.directive('slideToAcceptSuccess', function($timeout, platformInfo) {
2016-10-07 20:03:51 -04:00
return {
restrict: 'E',
templateUrl: 'views/includes/slideToAcceptSuccess.html',
transclude: true,
scope: {
isShown: '=slideSuccessShow',
onConfirm: '&slideSuccessOnConfirm',
hideOnConfirm: '=slideSuccessHideOnConfirm',
onShare: '=slideSuccessOnShare',
2016-10-07 20:03:51 -04:00
},
link: function(scope, element, attrs) {
scope.isCordova = platformInfo.isCordova;
scope.hasShareFunction = typeof scope.onShare === 'function';
2016-10-07 20:03:51 -04:00
var elm = element[0];
elm.style.display = 'none';
scope.$watch('isShown', function() {
2017-06-08 11:41:30 -03:00
if (scope.isShown) {
2016-10-07 20:03:51 -04:00
elm.style.display = 'flex';
$timeout(function() {
scope.fillScreen = true;
}, 10);
}
});
scope.onConfirmButtonClick = function() {
scope.onConfirm();
2017-06-08 11:41:30 -03:00
if (scope.hideOnConfirm) {
scope.fillScreen = false;
elm.style.display = 'none';
}
2016-10-07 20:03:51 -04:00
};
scope.onShareButtonClick = function() {
scope.onShare();
}
2016-10-07 20:03:51 -04:00
}
};
});