2018-08-30 15:07:55 +05:30
|
|
|
angular.module("webui.services.modals", []).factory("$modals", function() {
|
2013-01-29 22:52:30 +05:00
|
|
|
var modals = {};
|
|
|
|
return {
|
|
|
|
// register a new modal, cb is the function which
|
|
|
|
// will further recieve the args when called through
|
|
|
|
// invoke
|
|
|
|
register: function(name, cb) {
|
|
|
|
modals[name] = cb;
|
|
|
|
},
|
|
|
|
// invoke an already registered modal, false if not found
|
|
|
|
invoke: function(name, cb) {
|
|
|
|
if (!modals[name]) return false;
|
|
|
|
var args = Array.prototype.slice.call(arguments, 1);
|
|
|
|
return modals[name].apply({}, args);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
});
|