diff --git a/dialog-service.js b/dialog-service.js index 14d91a3..da1adf1 100644 --- a/dialog-service.js +++ b/dialog-service.js @@ -4,6 +4,7 @@ angular.module('dialogService', []).service('dialogService', var _this = this; _this.dialogs = {}; + _this.dialogDefaults = {}; this.open = function(id, template, model, options) { @@ -25,7 +26,7 @@ angular.module('dialogService', []).service('dialogService', // Extend is used instead of copy because window references are // often used in the options for positioning and they can't be deep // copied. - var dialogOptions = {}; + var dialogOptions = angular.extend({}, _this.dialogDefaults); if (angular.isDefined(options)) { angular.extend(dialogOptions, options); } @@ -98,6 +99,11 @@ angular.module('dialogService', []).service('dialogService', dialog.ref.dialog("close"); }; + this.setDialogDefaults = function(defaults) { + + _this.dialogDefaults = defaults; + }; + function cleanup (id) { // Get the dialog and throw exception if not found @@ -163,4 +169,4 @@ angular.module('dialogService', []).service('dialogService', return deferred.promise; } } -]); \ No newline at end of file +]);