Help in Loading


#1

Please, I need help to use “Loading” in:

  • Start application and get data from remote server using $http, while get data I need show “Loading” and the when return data showing un input.

http://ionicframework.com/docs/angularjs/views/loading/

No work!!!, please help.


#2

Here’s a demo:


#3

Thanks, work.

But , timeout should be finish the $http get json response

how could I do that?

$scope.showLoading = function() {

  	 $http({method: 'GET', url: 'http....'}).
      success(function(data, status, headers, config) {
        $scope.data = data;
      });
  
    $scope.loadingIndicator = $ionicLoading.show({
        content: 'Obtaining rate...',
        animation: 'fade-in',
        showBackdrop: false,
        maxWidth: 200,
        showDelay: 500
    }); 
    
    $timeout(function(){
      $scope.loadingIndicator.hide();
    },1000);   
  };

#4

You can hide the loader in the $http promise (the then() function) after binding the response data to the scope.

$scope.data = data;
$scope.loadingIndicator.hide();


#5

Perfect.

thank you very much. Work!!!