(function (app) { app.factory("msg", ["$ionicLoading", "$ionicPopup", "$timeout", function ($ionicLoading, $ionicPopup) { return { text: function (template, noBackdrop) { template = template || ""; var n = { template: template, duration:1000 }; if (noBackdrop) n["noBackdrop"] = true; $ionicLoading.show(n); }, success: function (template, noBackdrop) { template = template || ""; var n = { template: '
' + template, duration: 1000 }; if (noBackdrop) n["noBackdrop"] = true; $ionicLoading.show(n); }, error: function (template, noBackdrop) { template = template || ""; var n = { template: '
' + template, duration: 2000 }; if (noBackdrop) n["noBackdrop"] = true; $ionicLoading.show(n); }, hide: function () { $ionicLoading.hide() }, loading: function (template) { $ionicLoading.show({ showDelay:800, template: '' }); //超时退出 // setTimeout(function() { // $ionicLoading.hide(); // }, 11000); }, alert: function (title, template) { var o = { okText: "确定" }; if (title && template) { o["title"] = title; o["template"] = template } else { o["title"] = title; o["cssClass"] = "pop-alert calm" } $ionicPopup.alert(o) }, confirm: function (title, template, cancelText, okText) { var n = { okText: okText || "确定", cancelText: cancelText || "取消" }; if (title && template) { n["title"] = title; n["template"] = template } else { n["title"] = title; n["cssClass"] = "pop-alert" } return $ionicPopup.confirm(n) } } }]); })(angular.module('app.services'));