Ionic Platform

From WikiOD

Ionic platform[edit | edit source]


$ Ionic Platform[edit | edit source]

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

Method[edit | edit source]
 onHardwareBackButton(callback)

Platforms with a hardware back button can be bound to it in this way.

Parameter Type Details
callback function When this event occurs, the callback function is triggered.
 offHardwareBackButton(callback)

Remove the listening event of the back button.

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

Register the hardware back button action. When the button is clicked, only one action will be executed, so this method determines that the registered back button action has the highest priority.

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

Parameter Type Details
callback function Triggered when the back button is clicked, if the monitor has the highest priority.
priority number Only the highest priority will be executed.
actionId

(Optional)

* The id specifies this action. Default: a random and unique id.

Return value: function, a triggered function will cancel backButtonAction.

 ready([callback])

When the device is ready, a callback function is triggered.

Parameter Type Details
callback

(Optional)

function= The triggered function.