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

Commit 780c7c1

Browse files
committed
Merge pull request #29 from rbanks54/commonJs
CommonJS and AMD module loading support
2 parents 49b505a + 3d57a42 commit 780c7c1

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

angular-confirm.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,22 @@
44
* @version v1.2.1 - 2015-11-18
55
* @license Apache
66
*/
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) {
723
angular.module('angular-confirm', ['ui.bootstrap.modal'])
824
.controller('ConfirmModalController', function ($scope, $uibModalInstance, data) {
925
$scope.data = angular.copy(data);
@@ -92,3 +108,4 @@ angular.module('angular-confirm', ['ui.bootstrap.modal'])
92108
}
93109
}
94110
});
111+
}));

0 commit comments

Comments
 (0)