diff --git a/ng-sortable.js b/ng-sortable.js index 2e2db4d..a33b3c9 100644 --- a/ng-sortable.js +++ b/ng-sortable.js @@ -5,12 +5,17 @@ (function (factory) { 'use strict'; - if (window.angular && window.Sortable) { - factory(angular, Sortable); - } - else if (typeof define === 'function' && define.amd) { + if (typeof define === 'function' && define.amd) { define(['angular', './Sortable'], factory); } + else if (typeof require === 'function' && typeof exports === 'object' && typeof module === 'object') { + require('angular'); + factory(angular, require('./Sortable')); + module.exports = 'ng-sortable'; + } + else if (window.angular && window.Sortable) { + factory(angular, Sortable); + } })(function (angular, Sortable) { 'use strict';