Ionic loading indicator does not show

Hi, I’m trying to show the Ionic loader, but it does not work…

Here’s my code:

angular.module('starter.controllers', ['ionic'])

.controller('NaujasCtrl', function($scope, $location, $ionicLoading, $timeout) {
    
    $scope.show = function() {
        $ionicLoading.show({
            template: 'Ieškomas vairuotojas...'
        });
    };
    
    $scope.hide = function(){
        $ionicLoading.hide();
    };
    
    $scope.search = function()
    {
        $scope.show();
        
        $timeout(function(){
        $location.url('/app/search');
        }, 10000);
        
        $scope.hide();
    };
    
  
})

It goes to ‘/app/search’ after 10 seconds, but there is no sign of indicator… :frowning:

That’s because your are showing it then immediately hiding it.
you can test by commenting, $scope.hide() and see if the indicator is being displayed.

You could hide the preloader on the new page instead, after its content is loaded:

$scope.on('$viewContentLoaded', function()
  {
        $ionicLoading.hide();
  });
1 Like