HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
$ IonicLoading is ionic load a default interaction effect. You can also modify the contents inside the template inside.
angular.module('LoadingApp', ['ionic']) .controller('LoadingCtrl', function($scope, $ionicLoading) { $scope.show = function() { $ionicLoading.show({ template: 'Loading/en.' }); }; $scope.hide = function(){ $ionicLoading.hide(); }; });
Display a loading effect.
show(opts)
parameter | Types of | Detail |
---|
opts | object | loading indicator option. Available properties:
|
Hide a loading effect.
hide()
Attributes | Types of | Detail |
---|
delegate-handle (Optional) | 字符串 | The handle is defined with |
show-delete (Optional) | 布尔值 | Delete button list of items currently displayed or hidden. |
show-reorder (Optional) | 布尔值 | Sort button list items currently displayed or hidden. |
can-swipe (Optional) | 布尔值 | Whether the list item is allowed to slide display options button. Default: true. |
<html ng-app="ionicApp"> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> <title>Ionic Modal</title> </head> <body ng-controller="AppCtrl"> <ion-view title="Home"> <ion-header-bar> <h1 class="title">The Stooges</h1> </ion-header-bar> <ion-content has-header="true"> <ion-list> <ion-item ng-repeat="stooge in stooges" href="#">{{stooge.name}}</ion-item> </ion-list> </ion-content> </ion-view> </body> </html>
angular.module('ionicApp', ['ionic']) .controller('AppCtrl', function($scope, $timeout, $ionicLoading) { // Setup the loader $ionicLoading.show({ content: 'Loading', animation: 'fade-in', showBackdrop: true, maxWidth: 200, showDelay: 0 }); // Set a timeout to clear loader, however you would actually call the $ionicLoading.hide(); method whenever everything is ready or loaded. $timeout(function () { $ionicLoading.hide(); $scope.stooges = [{name: 'Moe'}, {name: 'Larry'}, {name: 'Curly'}]; }, 2000); });
Set the default options to load:
var app = angular.module('myApp', ['ionic']) app.constant('$ionicLoadingConfig', { template: '默认加载模板……' }); app.controller('AppCtrl', function($scope, $ionicLoading) { $scope.showLoading = function() { $ionicLoading.show(); //配置选项在 $ionicLoadingConfig 设置 }; });