ionicModal

Instantiated by the $ionicModal service.

Be sure to call remove() when you are done with each modal to clean it up and avoid memory leaks.

Note: a modal will broadcast ‘modal.shown’, ‘modal.hidden’, and ‘modal.removed’ events from its originating scope, passing in itself as an event argument. Note: both modal.removed and modal.hidden are called when the modal is removed.

Methods

initialize(options)

Creates a new modal controller instance.

Param Type Details
options object

An options object with the following properties:

  • {object=} scope The scope to be a child of. Default: creates a child of $rootScope.
  • {string=} animation The animation to show & hide with. Default: 'slide-in-up'
  • {boolean=} focusFirstInput Whether to autofocus the first input of the modal when shown. Will only show the keyboard on iOS, to force the keyboard to show on Android, please use the Ionic keyboard plugin. Default: false.
  • {boolean=} backdropClickToClose Whether to close the modal on clicking the backdrop. Default: true.
  • {boolean=} hardwareBackButtonClose Whether the modal can be closed using the hardware back button on Android and similar devices. Default: true.

show()

Show this modal instance.

  • Returns: promise A promise which is resolved when the modal is finished animating in.

hide()

Hide this modal instance.

  • Returns: promise A promise which is resolved when the modal is finished animating out.

remove()

Remove this modal instance from the DOM and clean up.

  • Returns: promise A promise which is resolved when the modal is finished animating out.

isShown()

  • Returns: boolean Whether this modal is currently shown.