-
-
Notifications
You must be signed in to change notification settings - Fork 81
/
Copy pathmodal-service.js
41 lines (31 loc) · 1.02 KB
/
modal-service.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
angular
.module('nzbhydraApp')
.service('GeneralModalService', GeneralModalService);
function GeneralModalService() {
this.open = function (msg, template, templateUrl, size, data) {
//Prevent circular dependency
var myInjector = angular.injector(["ng", "ui.bootstrap"]);
var $uibModal = myInjector.get("$uibModal");
var params = {};
if (angular.isUndefined(size)) {
params["size"] = size;
}
if (angular.isUndefined(template)) {
if (angular.isUndefined(templateUrl)) {
params["template"] = '<pre style="margin:0">' + msg + '</pre>';
} else {
params["templateUrl"] = templateUrl;
}
} else {
params["template"] = template;
}
params["resolve"] =
{
data: function () {
return data;
}
};
var modalInstance = $uibModal.open(params);
modalInstance.result.then();
};
}