ionique couche de fond
Nous avons souvent besoin de l'interface utilisateur, par exemple, dans la boîte de pop-up, boîte de charge, apparaît d'autres couches pour afficher ou masquer la couche de fond.
Dans le composant peut être utilisé dans $ ionicBackdrop.retain () pour afficher une couche de fond, un ionicBackdrop.release $ () Cacher la couche de fond.
Après chaque appel de conserver, l'arrière-plan sera affiché jusqu'à ce que la libération d'appel afin d'éliminer la couche de fond.
Exemples
Le code HTML
<body ng-app="starter" ng-controller="actionsheetCtl" > <ion-pane> <ion-content > <h2 ng-click="action()">$ionicBackdrop</h2> </ion-content> </ion-pane> </body>
code JavaScript
angular.module('starter', ['ionic']) .run(function($ionicPlatform) { $ionicPlatform.ready(function() { // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard // for form inputs) if(window.cordova && window.cordova.plugins.Keyboard) { cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); } if(window.StatusBar) { StatusBar.styleDefault(); } }); }) .controller( 'actionsheetCtl',['$scope','$timeout' ,'$ionicBackdrop',function($scope,$timeout,$ionicBackdrop){ $scope.action = function() { $ionicBackdrop.retain(); $timeout(function() { //默认让它1秒后消失 $ionicBackdrop.release(); }, 1000); }; }])
Afficher comme indiqué ci-dessous: