2017-01-19 53 views

回答

0

對於離子1可以使用$ionicLoading

angular.module('LoadingApp', ['ionic']) 
.controller('LoadingCtrl', function($scope, $ionicLoading) { 
    $scope.show = function() { 
    $ionicLoading.show({ 
     template: 'Loading...', 
     duration: 3000 
    }).then(function(){ 
     console.log("The loading indicator is now displayed"); 
    }); 
    }; 
    $scope.hide = function(){ 
    $ionicLoading.hide().then(function(){ 
     console.log("The loading indicator is now hidden"); 
    }); 
    }; 
}); 

附加例如:

.controller('ExampleCtrl', ['$scope', '$timeout', '$ionicLoading', 
    function($scope, $timeout, $ionicLoading) { 
     $scope.functionName= function() { 
       $ionicLoading.show({ 
        template: 'Loading...' 
       var url = 'http://myapi.php'; 
       $timeout(function() { 
        Data.getdata(function(data) { 
         $scope.getdata = data; 
        }, url); 
        //Stop the ion-refresher from spinning 
        $scope.$broadcast('scroll.refreshComplete'); 
        $ionicLoading.hide(); 
       }, 1000); 
      } 
     } 
     $scope.functionName(); 
    } 
]) 
相關問題