const template = ` `; alertModalFactory.$inject = ['$uibModal', '$sce']; export function alertModalFactory( $uibModal: ng.ui.bootstrap.IModalService, $sce: ng.ISCEService ) { const service = { Show( callback: any, title: string, message: any, optionConfirm: any, backdrop: any, highlightedButton: any ) { message = message || ''; optionConfirm = optionConfirm || 'Confirm'; backdrop = backdrop || true; highlightedButton = highlightedButton || 0; const tempConfirmWidth = optionConfirm.length; const optionWidth = tempConfirmWidth * 9 + 24; const callbackParams = callback.params || {}; $uibModal .open({ template, backdrop, controller: [ '$scope', '$uibModalInstance', ( $scope: ng.IScope, $uibModalInstance: ng.ui.bootstrap.IModalInstanceService ) => { $scope.modalTitle = $sce.trustAsHtml(title); $scope.modalMessage = $sce.trustAsHtml(message); $scope.optionConfirm = optionConfirm; $scope.optionWidth = optionWidth; $scope.highlightedButton = highlightedButton; $scope.Confirm = () => { $uibModalInstance.close(); }; }, ], }) .result.then( () => { callback.confirm(callbackParams); }, () => { callback.confirm(callbackParams); } ); }, }; return service; }