The Ionic Platform service
The first service we are going to deal with is the Ionic Platform service ($ionicPlatform
). This service provides device-level hooks that you can tap into to better control your application's behavior.
We will start off with the very basic ready
method. This method is fired once the device is ready or immediately, if the device is already ready.
To try out Ionic Platform services, we will be scaffolding a blank app and then working with the services. Before we scaffold the blank app, we will create a folder named chapter5
. Inside that folder, we will run the following command:
ionic start -a "Example 16" -i app.example.sixteen example16 blank
Once the app is scaffolded, if you open www/js/app.js
, you should find a section such as:
.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...