From acaf72b609779c94b65f77fd45badf5315f53718 Mon Sep 17 00:00:00 2001 From: _pants <_pants@anotherwebsite.org> Date: Sat, 9 Feb 2013 13:52:10 -0500 Subject: [PATCH] feat(modal): allow global override of modal options --- src/modal/modal.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/modal/modal.js b/src/modal/modal.js index a0834c2a9a..8ae276d71b 100644 --- a/src/modal/modal.js +++ b/src/modal/modal.js @@ -1,14 +1,15 @@ -angular.module('ui.bootstrap.modal', []).directive('modal', ['$parse',function($parse) { +angular.module('ui.bootstrap.modal', []) +.constant('modalConfig', { + backdrop: true, + escape: true +}) +.directive('modal', ['$parse', 'modalConfig', function($parse, modalConfig) { var backdropEl; var body = angular.element(document.getElementsByTagName('body')[0]); - var defaultOpts = { - backdrop: true, - escape: true - }; return { restrict: 'EA', link: function(scope, elm, attrs) { - var opts = angular.extend(defaultOpts, scope.$eval(attrs.uiOptions || attrs.bsOptions || attrs.options)); + var opts = angular.extend({}, modalConfig, scope.$eval(attrs.uiOptions || attrs.bsOptions || attrs.options)); var shownExpr = attrs.modal || attrs.show; var setClosed;