Ionic Background Layer

From WikiOD

Ionic background layer[edit | edit source]

We often need to display or hide the background layer in the UI, such as pop-up boxes, loading boxes, and other pop-up layers.

In the component, you can use $ionicBackdrop.retain() to display the background layer, and use $ionicBackdrop.release() to hide the background layer.

After each call to retain, the background will be displayed until release is called to eliminate the background layer.

Instance[edit | edit source]

HTML code[edit | edit source]
 <body ng-app="starter" ng-controller="actionsheetCtl">
 	        <code><h2 ng-click="action()">$ionicBackdrop</h2></code>
JavaScript code[edit | edit source]
 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) {
     if(window.StatusBar) {
 .controller('actionsheetCtl',['$scope','$timeout' ,'$ionicBackdrop',function($scope,$timeout,$ionicBackdrop){
     $scope.action = function() {
        $timeout(function() {//By default let it disappear after 1 second
        }, 1000);