我想創建一個離子消息框的自定義版本。該功能使用$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