angular-material mdDialog shows and hides straight away sometimes

31 Views Asked by At

Using angular-material in an ionic V1 application.

$mdDialog.show() works fine but sometimes, you call show() => modal shows => modal hides straight away.

I have spotted the problem happened on a mobile device and using chrome web inspector with an emulated device (little device icon). Banged my head against the wall for a long time and found clickOutsideToClose: true was the problem.

Remove it and you're done.

  var alert = {
    parent: angular.element(document.body),
    controller: controller,
    templateUrl: 'templates/shared/components/modal-confirm.html',
    fullscreen: false,
    // clickOutsideToClose: true,  #deleteMe         
    locals: {
      options: options
    }
  };

  return $mdDialog.show(alert);
1

There are 1 best solutions below

0
On

clickOutsideToClose is broken. remove it.