Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Commit acaf72b

Browse files
_pantspkozlowski-opensource
_pants
authored andcommitted
feat(modal): allow global override of modal options
1 parent 739f86f commit acaf72b

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/modal/modal.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
angular.module('ui.bootstrap.modal', []).directive('modal', ['$parse',function($parse) {
1+
angular.module('ui.bootstrap.modal', [])
2+
.constant('modalConfig', {
3+
backdrop: true,
4+
escape: true
5+
})
6+
.directive('modal', ['$parse', 'modalConfig', function($parse, modalConfig) {
27
var backdropEl;
38
var body = angular.element(document.getElementsByTagName('body')[0]);
4-
var defaultOpts = {
5-
backdrop: true,
6-
escape: true
7-
};
89
return {
910
restrict: 'EA',
1011
link: function(scope, elm, attrs) {
11-
var opts = angular.extend(defaultOpts, scope.$eval(attrs.uiOptions || attrs.bsOptions || attrs.options));
12+
var opts = angular.extend({}, modalConfig, scope.$eval(attrs.uiOptions || attrs.bsOptions || attrs.options));
1213
var shownExpr = attrs.modal || attrs.show;
1314
var setClosed;
1415

0 commit comments

Comments
 (0)