Ionic Backdrop
Ionic Backdrop : It shows the overlay above the content and below the popups, loading and other overlays. Method $ionicBackdrop.retain() and $ionicBackdrop.release() is used for backdrop in ionic. $ionicBackdrop.retain() is used to apply overlay over the content. $ionicBackdrop.release() is used to remove Ionic Backdrop from the content. Each time when $ionicBackdrop.retain() is called the $ionicBackdrop.release() method is also called. Here we are going to explain the ionic backdrop functionality with example and demo.
Ionic Backdrop
Here is syntax and example of ionic Backdrop-
Ionic Backdrop example
.controller('MainCtrl', function($scope, $ionicBackdrop, $timeout) { // Your Logic Here.. $scope.showIonicBackdrop = function() { $ionicBackdrop.retain(); $timeout(function() { $ionicBackdrop.release(); }, 5000); }; }, function(err) { console.error('ERR', err); // err.status will contain the status code }); |
You first need to import service of backdrop in controller then create a function which contains the ionic retain and release method. if you run the above example it will produce the following output –
More About Ionic Backdrop
Let us have more example of Ionic Backdrop.
Ionic Execute Action on Backdrop Disappear/Hidden
You Can Execute Action on backdrop disappear event as below –
Action on Backdrop Disappear/Hidden
.controller('MainCtrl', function($scope, $ionicBackdrop, $timeout, $rootScope) { // Your Logic Here.. $scope.showIonicBackdrop = function() { $ionicBackdrop.retain(); $timeout(function() { $ionicBackdrop.release(); }, 5000); }; // Add action on backdrop disappearing $scope.$on('backdrop.hidden', function() { // Your action }); }, function(err) { console.error('ERR', err); // err.status will contain the status code }); |
Ionic Execute Action on Backdrop Appear/Show
You Can Execute Action on backdrop Appear event as below –
Ionic Execute Action on Backdrop Appear/Show
.controller('MainCtrl', function($scope, $ionicBackdrop, $timeout, $rootScope) { // Your Logic Here.. $scope.showIonicBackdrop = function() { $ionicBackdrop.retain(); $timeout(function() { $ionicBackdrop.release(); }, 5000); }; // Add action on backdrop disappearing $scope.$on('backdrop.shown', function() { // Your action }); }, function(err) { console.error('ERR', err); // err.status will contain the status code }); |
Advertisements
Add Comment
📖 Read More
- 1. Ionic js Content
- 2. Ionic Ion-refresher
- 3. Ionic Events
- 4. Ionic Keyboard
- 5. Ionic loading
- 6. Ionic Modal
- 7. Ionic Navigation
- 8. Ionic Popover
- 9. Ionic Popup
- 10. Ionic Scroll