Skip to content
This repository was archived by the owner on Apr 20, 2023. It is now read-only.

Commit 4a7fa8e

Browse files
committed
use improved module loading wrapper
1 parent b8f71b7 commit 4a7fa8e

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

angular-confirm.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,22 @@
44
* @version v1.2.1 - 2015-11-18
55
* @license Apache
66
*/
7-
/* commonjs package manager support (eg componentjs) */
8-
if (typeof module !== "undefined" && typeof exports !== "undefined" && module.exports === exports) {
9-
module.exports = "angular-confirm";
10-
}
11-
(function(angular) {
7+
(function (root, factory) {
8+
'use strict';
9+
if (typeof define === 'function' && define.amd) {
10+
// AMD. Register as an anonymous module.
11+
define(['angular'], factory);
12+
} else if (typeof module !== 'undefined' && typeof module.exports === 'object') {
13+
// CommonJS support (for us webpack/browserify/ComponentJS folks)
14+
module.exports = factory(require('angular'));
15+
} else {
16+
// in the case of no module loading system
17+
// then don't worry about creating a global
18+
// variable like you would in normal UMD.
19+
// It's not really helpful... Just call your factory
20+
return factory(root.angular);
21+
}
22+
}(this, function (angular) {
1223
angular.module('angular-confirm', ['ui.bootstrap.modal'])
1324
.controller('ConfirmModalController', function ($scope, $uibModalInstance, data) {
1425
$scope.data = angular.copy(data);
@@ -97,4 +108,4 @@ angular.module('angular-confirm', ['ui.bootstrap.modal'])
97108
}
98109
}
99110
});
100-
})(angular);
111+
}));

0 commit comments

Comments
 (0)