Importing dependencies into SP widget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2017 02:54 AM
Morning all,
I'm trying to import the dragula libraries into a custom Service Portal widget.
I've tried both of these versions of Dragula for angular 1
- GitHub - luckylooke/dragular: Angular drag and drop based on dragula.js. Visit
- GitHub - bevacqua/angularjs-dragula: Drag and drop so simple it hurts
I've had success previously with a different drag and drop library, but I need some of the extra features of dragula.
In particular, for the directive and service providers, when I load these in the widget, I get "require not defined" and "module not defined".
At present I'm just trying to load the libraries with the widget, I'm yet to call dragula inside my widget anywhere.
Any hints as to how to correctly import a more complex library such as this, I'd be grateful.
Cheers

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2017 07:45 AM
Hi Alex
Not sure Service Portal is cut out for that. Normally it's straightforward to add external libraries, Dragular looks a bit more complex.
The portal guru nathanfirth might know?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2017 12:32 PM
The "require not defined" is because they're using require.js to include the JS files and dependencies. That won't work in Service Portal so you'll want to find the distribution version of the JS file (try using the JS file in the "dist" folder) and see if that solves it. Also are you trying to add it as an Angular Provider, Dependency, or JS Include?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2017 01:08 AM
If I remove the service and directive files from the angular providers list for my widget, it gets rid of the module and required not found issue.
Then with just the dragula lib files from the dist folder as a dependency I get the following error in my console on load:
Unknown provider: dragularServiceProvider <- dragularService