Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

$ionicLoading.show while resolving state objects

$
0
0

Do you also have this code (or similar) in your app to show the spinner when $http is used (in a service for example?)?

.config(function($httpProvider)
{
	$httpProvider.interceptors.push(function($rootScope)
	{
		return {

			//http request show loading
			request: function(config)
			{
				$rootScope.$broadcast('loading:show');
				return config;
			},

			//hide loading in case any occurred
			requestError: function(response)
			{
				$rootScope.$broadcast('loading:hide');
				return response;
			},

			//Hide loading once got response
			response: function(response)
			{
				$rootScope.$broadcast('loading:hide');
				return response;
			},

			//Hide loading if got any response error
			responseError: function(response)
			{
				$rootScope.$broadcast('loading:hide');
				return response;
			}
		}
	})
})

When i comment the code above in my app and run it the spinner shows up while resolving the data in the state. Maybe this sets you on track for a solution?


Viewing all articles
Browse latest Browse all 228595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>