【发布时间】:2016-05-14 14:07:12
【问题描述】:
所以,我有这个应用程序,它使用此代码在加载一些 ajax 请求时在所有屏幕内容上显示和隐藏加载屏幕。
app.config( function( $stateProvider, $urlRouterProvider, $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
}
}
});
})
.run(function( $state, $rootScope, $ionicLoading, $storage )
{
$rootScope.$on('loading:show', function()
{
$ionicLoading.show({template: 'Loading'});
});
$rootScope.$on('loading:hide', function()
{
$ionicLoading.hide();
});
});
当我想加载我使用的东西时:
$http.post( "http://myexample.com.br/json-data", {param1:"1"} ).then(function(result){});
问题是,在某些情况下,我希望在后台加载某些内容而不显示加载屏幕。
【问题讨论】:
标签: javascript angularjs ionic-framework