Skip to content

Commit 0a8e53f

Browse files
committed
Use module loader section
The top-level section assists with loading this library and its dependencies by different module loading technologies.
1 parent 0839310 commit 0a8e53f

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

angular-navigation-service.js

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
1-
(function (window, _, angular, undefined) {
1+
/* globals define, module */
2+
(function (root, factory) {
23
'use strict';
3-
var module = angular.module('navigation.service', []);
4-
module.provider('$navigation', function () {
4+
if (typeof module !== 'undefined' && module.exports) {
5+
if (typeof angular === 'undefined') {
6+
factory(
7+
typeof _ === 'undefined' ? require('lodash') : root._,
8+
require('angular')
9+
);
10+
} else {
11+
factory(root._, root.angular);
12+
}
13+
module.exports = 'ng-navigation-service';
14+
} else if (typeof define === 'function' && define.amd) {
15+
define(['lodash', 'angular'], factory);
16+
} else {
17+
factory(root._, root.angular);
18+
}
19+
}(this, function (_, angular, undefined) {
20+
'use strict';
21+
angular.module('navigation.service', []).provider('$navigation', function () {
522
var configuration = {
623
activeLinkDecorator: undefined,
724
inactiveLinkDecorator: undefined,
@@ -149,4 +166,5 @@
149166
};
150167
}];
151168
});
152-
})(window, window._, window.angular);
169+
return angular;
170+
}));

0 commit comments

Comments
 (0)