var app = angular.module('ionicApp', ['ionic']) app.config(function($httpProvider) { $httpProvider.interceptors.push(function($rootScope) { return { request: function(config) { $rootScope.$broadcast('loading:show') return config }, response: function(response) { $rootScope.$broadcast('loading:hide') return response } } }) }) app.run(function($rootScope, $ionicLoading) { $rootScope.$on('loading:show', function() { $ionicLoading.show({template: 'loading'}) }); $rootScope.$on('loading:hide', function() { $ionicLoading.hide() }); });原文地址:http://learn.ionicframework.com/formulas/loading-screen-with-interceptors/
ionic将ionicLoading与http请求绑定
最新推荐文章于 2022-03-16 09:11:24 发布