$ionicLoading

用一个覆盖层表示当前处于活动状态,来阻止用户的交互动作。

用法

angular.module('LoadingApp', ['ionic'])
.controller('LoadingCtrl', function($scope, $ionicLoading) {
  $scope.show = function() {
    $ionicLoading.show({
      template: 'Loading...'
    });
  };
  $scope.hide = function(){
    $ionicLoading.hide();
  };
});

方法

show(opts)

显示一个loading指示器。如果该指示器已经显示,它会设置给定选项,并保持指示器显示。

参数 类型 详情
opts object

loading指示器的选项。可用属性:

  • {string=} template 指示器的html内容。
  • {string=} templateUrl 一个加载html模板的url作为指示器的内容。
  • {boolean=} noBackdrop 是否隐藏背景。默认情况下它会显示。
  • {number=} delay 指示器延迟多少毫秒显示。默认为不延迟。
  • {number=} duration 等待多少毫秒后自动隐藏指示器。默认情况下,指示器会一直显示,直到触发.hide()

hide()

隐藏loading指示器,如果它已显示。