mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-31 11:40:47 +00:00
35 lines
719 B
JavaScript
35 lines
719 B
JavaScript
/**
|
|
* @ngdoc service
|
|
* @name superProductivity.Dialogs
|
|
* @description
|
|
* # Dialogs
|
|
* Service in the superProductivity.
|
|
*/
|
|
|
|
(function () {
|
|
'use strict';
|
|
|
|
angular
|
|
.module('superProductivity')
|
|
.service('Dialogs', Dialogs);
|
|
|
|
/* @ngInject */
|
|
function Dialogs($mdDialog, DIALOGS) {
|
|
|
|
return function (dialogName, locals) {
|
|
|
|
// copy and extend defaults for dialog
|
|
let defaults = angular.copy(DIALOGS.DEFAULTS);
|
|
let dialog = angular.extend(defaults, DIALOGS[dialogName]);
|
|
|
|
// add passed variables
|
|
dialog = angular.extend(dialog, {
|
|
locals: locals
|
|
});
|
|
|
|
// return dialog instance for further handling
|
|
return $mdDialog.show(dialog);
|
|
};
|
|
}
|
|
|
|
})();
|