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

Commit

Permalink
Merge pull request #29 from rbanks54/commonJs
Browse files Browse the repository at this point in the history
CommonJS and AMD module loading support
  • Loading branch information
jameskleeh committed Dec 8, 2015
2 parents 49b505a + 3d57a42 commit 780c7c1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions angular-confirm.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@
* @version v1.2.1 - 2015-11-18
* @license Apache
*/
(function (root, factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['angular'], factory);
} else if (typeof module !== 'undefined' && typeof module.exports === 'object') {
// CommonJS support (for us webpack/browserify/ComponentJS folks)
module.exports = factory(require('angular'));
} else {
// in the case of no module loading system
// then don't worry about creating a global
// variable like you would in normal UMD.
// It's not really helpful... Just call your factory
return factory(root.angular);
}
}(this, function (angular) {
angular.module('angular-confirm', ['ui.bootstrap.modal'])
.controller('ConfirmModalController', function ($scope, $uibModalInstance, data) {
$scope.data = angular.copy(data);
Expand Down Expand Up @@ -92,3 +108,4 @@ angular.module('angular-confirm', ['ui.bootstrap.modal'])
}
}
});
}));

0 comments on commit 780c7c1

Please sign in to comment.