util_srv.js 637 B

12345678910111213141516171819202122232425262728293031
  1. define([
  2. 'angular',
  3. '../core_module',
  4. ],
  5. function (angular, coreModule) {
  6. 'use strict';
  7. coreModule.default.service('utilSrv', function($rootScope, $modal, $q) {
  8. this.init = function() {
  9. $rootScope.onAppEvent('show-modal', this.showModal, $rootScope);
  10. };
  11. this.showModal = function(e, options) {
  12. var modal = $modal({
  13. modalClass: options.modalClass,
  14. template: options.src,
  15. persist: false,
  16. show: false,
  17. scope: options.scope,
  18. keyboard: false
  19. });
  20. $q.when(modal).then(function(modalEl) {
  21. modalEl.modal('show');
  22. });
  23. };
  24. });
  25. });