1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-05 02:29:26 +02:00
OpenSTF/res/app/components/stf/common-ui/modals/generic-modal/generic-modal-service.js
2019-06-12 10:29:07 +02:00

38 lines
884 B
JavaScript

/**
* Copyright © 2019 code initially contributed by Orange SA, authors: Denis Barbaron - Licensed under the Apache license 2.0
**/
module.exports =
function GenericModalServiceFactory($uibModal) {
const service = {}
const ModalInstanceCtrl = function($scope, $uibModalInstance, data) {
$scope.data = data
$scope.ok = function() {
$uibModalInstance.close(true)
}
$scope.cancel = function() {
$uibModalInstance.dismiss('cancel')
}
}
service.open = function(data) {
var modalInstance = $uibModal.open({
template: require('./generic-modal.pug'),
controller: ModalInstanceCtrl,
size: data.size,
animation: true,
resolve: {
data: function() {
return data
}
}
})
return modalInstance.result
}
return service
}