美文网首页
如何在ionic中添加加载提示

如何在ionic中添加加载提示

作者: stevezheng | 来源:发表于2015-07-31 02:06 被阅读0次

基本思路是在controller中添加$ionicLoading,通过判断数据载入情况,显示与隐藏加载提示。

使用方法

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

方法

show(opts) 显示加载提示

{string=} template html模板
{string=} templateUrl 通过url加载模板
{object=} scope 作用域. 默认是$rootScope.
{boolean=} noBackdrop Whether to hide the backdrop. By default it will be shown.
{boolean=} hideOnStateChange Whether to hide the loading spinner when navigating to a new state. Default false.
{number=} delay 延迟显示,多少毫秒后显示加载提示
{number=} duration 自动隐藏,多少毫秒后自动隐藏加载提示。默认是不自动隐藏

hide() 隐藏加载提示

相关文章

网友评论

      本文标题:如何在ionic中添加加载提示

      本文链接:https://www.haomeiwen.com/subject/bwtvqttx.html