我想创建一个离子消息框的自定义版本。该功能使用$ionicPopup
。
$myShowPopup = function() {
$scope.data = {};
$ionicPopup.show({
subTitle: 'There is no network connection right now.',
scope: $scope,
buttons: [
{ text: 'Got it'
type: 'button clear'},
]});
}
我需要在多个地方调用该函数,例如,在以下app.js代码中调用该函数。应该在哪里定义?
angular.module('app', ['ionic', 'app.controllers', 'app.routes', 'app.services', 'app.directives'])
.run(function ($ionicPlatform, $ionicPopup) {
$ionicPlatform.ready(function() {
......
// Need to call it here
......
})
.config(function ($resourceProvider) {
angular.forEach($resourceProvider.defaults.actions, function (action) {
action['interceptor'] = {
responseError: function (httpResponse) {
......
// And here.
......
}
};
})
});
我在手机上试了一下。但是,它会在每个webapi调用上弹出消息,并且没有收到任何数据? – ca9163d9
谢谢。但是,它仍然会在开始时弹出一次? – ca9163d9
我删除它。该消息仍然显示。状态码为0. – ca9163d9