Easy Tutorial
❮ Ionic Grid Ionic Ionicpopup ❯

ionic Platform


$ionicPlatform

$ionicPlatform is used to detect the current platform and override the Android back button in PhoneGap/Cordova, among other things.

Methods

onHardwareBackButton(callback)

For platforms with a hardware back button, this method can be used to bind to it.

Parameter Type Details
callback function The callback function to trigger when the event occurs.
offHardwareBackButton(callback)

Removes the back button event listener.

Parameter Type Details
callback function The original bound listener function.
registerBackButtonAction(callback, priority, [actionId])

Registers a hardware back button action. Only one action will be executed when the button is clicked, so this method determines the highest priority for the registered back button action.

For example, if a pop-up menu is already displayed, the back button should close the menu instead of returning to a page view or closing an open modal.

Parameter Type Details
callback function Triggered when the back button is clicked, if this listener has the highest priority.
priority number Only the highest priority action will be executed.
actionId (optional) * The ID that specifies this action. Default: a random and unique ID.

Returns: Function, a triggered function that will unregister the backButtonAction.

ready([callback])

Triggers a callback function when the device is ready.

Parameter Type Details
callback (optional) function= The function to trigger.

Returns: Promise object, resolved after the object is successfully constructed.

❮ Ionic Grid Ionic Ionicpopup ❯