Wallet/src/js/directives/slideToAcceptSuccess.js

34 lines
972 B
JavaScript
Raw Normal View History

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