Close Popup with tap/click on background

Is it possible to configure the popup that it closes with a tap or click outside of the popup?
Thank you!

Well that would defeat the purpose of popup wouldn’t it? A popup is designed to have the user interact with it in order to dismiss it.

Have to think about that :slight_smile:

If you don’t need the interaction you could always use a modal, which lets you click the backdrop and dismiss it.

The ability to do this has been a common scenario for pop-ups for years and I think it should be included as an option for popups.

A good example, on an Android phone Google Calendar. When you create an event, click to choose which calendar. You are given a popup style dialog box. If you do not want to select a calendar, you can click the background. You’re not forced to make a selection and a needless button to dismiss is not included in the popup.


1 Like

Also modal + backdropClickToClose doesn’t work because when your interface is smartphone sized, there is no backdrop. The modal consumes the whole screen.

I agree I would really like this feature.

Sometimes you need users to cancel an action by clicking the backdrop. The pop closes on android if you press back. The backdrop click is really the same thing. Dismissing the pop up without taking an action

1 Like

+1. Definitely very useful/necessary functionality. Like @deliriousrhino said, clicking on the backdrop or clicking outside of the popup, especially if there is a backdrop, is the equivalent of pressing escape on a computer or pressing back on Android. It is a form of interaction.
Any ideas on how to implement this as a workaround? i.e. detect a click on the backdrop and close the popup. I really need this to work.

I would love to see this functionality added into ionic, as well.
I ran into the same issue recently. This is the workaround we’re currently using.
It feels kinda hacky, but, hey, it works :slight_smile:

$timeout(function() {
      var ele = angular.element(document.querySelector('.popup-showing')).on('click', function(e) {
          // This prevents us from closing the modal if clicking on buttons etc
          if( != this) {
  }, 500);
1 Like

I implemented a workaround as a service to achieve this:

//TODO This is a workaround. remove when ionic adds support for this
angular.module('myModule').factory('ClosePopupService', function($document, $ionicPopup, $timeout){
  var lastPopup;
  return {
    register: function(popup) {
        var element = $ionicPopup._popupStack.length>0 ? $ionicPopup._popupStack[0].element : null;
        if(!element || !popup || !popup.close) return;
        element = element && element.children ? angular.element(element.children()[0]) : null;
        lastPopup  = popup;
        var insideClickHandler = function(event){
        var outsideHandler = function() {
        element.on('click', insideClickHandler);
        $document.on('click', outsideHandler);
          lastPopup = null;
'click', insideClickHandler);
          $'click', outsideHandler);
    closeActivePopup: function(){
      if(lastPopup) {
        return lastPopup;
.controller('MyCtrl',function($ionicPopup, ClosePopupService){
  var popupConfig = {..someconfig..};
  var popup = $;


Well, I’m a bit late on this one, but my client also wanted to be able to close the popup by tapping on the background. So I made a Service and made it available on Github:

To make things easier for people who would want this feature, I made it available in the bower registry.

You can install it just bu running:
$ bower install ionic-close-popup

Include the ionic.closePopup module in your app’s dependencies:
angular.module('app', ['ionic', 'ionic.closePopup'])

Register your newly created popup to the closePopupService service:

var alertPopup = $ionicPopup.alert({
  title: 'Alert popup',
  template: 'Tap outside it to close it'

Here is a Codepen showing a live code:

Hope this helps !


This will help friends

1 Like

In your Codepen demo, you just forgot to add your .js file to make it work and show it to us
<script src="//"></script>

But it work perfect

I use it to show complementary list informations


I soo much needed this…thanks :slight_smile:

This helped me :slight_smile:

$ionicPopover.fromTemplateUrl('my-popover.html', {
  scope: $scope,
  "backdropClickToClose" :false
}).then(function(popover) {
  $scope.popover = popover;
1 Like

thanks so much, bro <3