
- Ionic Basics Tutorial
- Ionic - Home
- Ionic - Overview
- Ionic - Environment Setup
- Ionic CSS Components
- Ionic - Colors
- Ionic - Content
- Ionic - Header
- Ionic - Footer
- Ionic - Buttons
- Ionic - Lists
- Ionic - Cards
- Ionic - Forms
- Ionic - Toggle
- Ionic - Checkbox
- Ionic - Radio Button
- Ionic - Range
- Ionic - Select
- Ionic - Tabs
- Ionic - Grid
- Ionic - Icons
- Ionic - Padding
- Ionic Javascript Components
- Ionic - JS Action Sheet
- Ionic - JS Backdrop
- Ionic - JS Content
- Ionic - JS Forms
- Ionic - JS Events
- Ionic - JS Header
- Ionic - JS Footer
- Ionic - JS Keyboard
- Ionic - JS List
- Ionic - JS Loading
- Ionic - JS Modal
- Ionic - JS Navigation
- Ionic - JS Popover
- Ionic - JS Popup
- Ionic - JS Scroll
- Ionic - JS Side Menu
- Ionic - JS Slide Box
- Ionic - JS Tabs
- Ionic Advanced Concepts
- Ionic - Cordova Integration
- Ionic - AdMob
- Ionic - Camera
- Ionic - Facebook
- Ionic - In App Browser
- Ionic - Native Audio
- Ionic - Geolocation
- Ionic - Media
- Ionic - Splash Screen
- Ionic Useful Resources
- Ionic - Quick Guide
- Ionic - Useful Resources
- Ionic - Discussion
Ionic - JavaScript Platform
Angular offers a way to recognize the platform and to configure it. The service for this is $ionicPlatform. It contains various methods for managing configuration. We will show all of them in the following table.
Methods for $ionicPlatform()
Method | Parameter | Type | Details |
---|---|---|---|
onHardwareBackButton(parameter) | callback | function | Used for binding to hardware back button. |
offHardwareBackButton(parameter) | callback | function | Used for removing the hardware back button. |
registerBackButtonAction(parameter1, parameter2, parameter3) | callback, priority, actionId | function, number, * | callback is function that is called when back button is pressed. priority will set a priority since only the action with the highest priority will be executed. actionId can be assigned to the action. Random id will be set if it is not assigned |
on(parameter1, parameter2) | type, callback | string, function | type is used to set event for the action. callback is function that will be executed when event occurs. |
ready(parameter) | callback | function | Returns the promise object which is resolved when device is ready. |
If you open app.js file, you can see how these methods can be used in your app. Following code snippet is from default Ionic configuration. You can see usage case of the ready method.
.run(function($ionicPlatform) { $ionicPlatform.ready(function() { // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard for form inputs) if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) { cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); cordova.plugins.Keyboard.disableScroll(true); } if (window.StatusBar) { // org.apache.cordova.statusbar required StatusBar.styleLightContent(); } }); })
Advertisements