ionic Platform
$ionicPlatform
$ionicPlatform is used to detect the current platform and to override the Android back button in PhoneGap/Cordova, among other things.
Method
onHardwareBackButton(callback)
On platforms with a hardware back button, you can bind to it using this method.
| Parameters | Type | Details |
|---|---|---|
| callback | function |
When this event occurs, the callback function is triggered. |
offHardwareBackButton(callback)
Remove the back button listener.
| Parameters | Type | Details |
|---|---|---|
| callback | function |
The originally bound watcher function. |
registerBackButtonAction(callback, priority, [actionId])
Register a hardware back button action. When the button is tapped, only one action executes, so this method determines which registered back button action has the highest priority.
For example, if an action sheet is already shown, the back button should close the action sheet rather than go back a page view or close an open modal.
| Parameters | Type | Details |
|---|---|---|
| callback | function |
Triggered when the back button is tapped, if this watcher has the highest priority. |
| priority | number |
Only the highest priority one executes. |
| actionId |
(optional)
| `*` |The id specifies this action. Default: a random and unique id.
|Return value: function, a function that, when triggered, will deregister the backButtonAction.
ready([callback])
When the device is ready, a callback function is triggered.
| Parameters | Type | Details |
|---|---|---|
| callback |
(optional)
| `function=` |The function to trigger.
|Returns: promise object, resolved after the object is successfully constructed.