Custom Scripts: get modal functionality from angular.ui

Hello!

Is it possible to somehow re-use angular bootstrap-ui modal functionality that is implemented in camunda in my Custom Scripts?

@sebastian.stamm don’t want to bother you too much, but you are always very helpful, perhaps you can advise again? :slight_smile:
Thanks and kind regards,
Deniss

Hi Deniss,

thanks, I try my best :slight_smile:

In custom scripts, you can define your own angular-module that is loaded with the application. In this module you can inject all the common services, including the modal functionality. This snippet would add a plugin to the cockpit dashboard that opens a modal (adapted from this example):

define(['angular'], function(angular) {
  var ngModule = angular.module('myCustomModule', []);
  ngModule.config(['ViewsProvider', function(ViewsProvider) {
    ViewsProvider.registerDefaultView('cockpit.dashboard', {
      id: 'somePluginId',
      priority: 9001,
      controller: ['$modal', function($modal) {
        $modal.open({
          template: '<h2>Hello :)</h2>'
        });
      }],
      template: '<h2>yay</h2>'
    });
  }]);

  return ngModule;
});

Is that what you are looking for?

Best regards
Sebastian

1 Like

Thanks @sebastian.stamm for your quick and correct reply! :slight_smile: Have a nice weekend!

Kind regards,
Deniss

1 Like