The platform service returns the available information about the current platform. The new and improved platform service of Ionic has more information that helps us to customize the app based on the device type.
To understand the platform service better, we will scaffold a blank app. Run the following:
ionic start -a "Example 11" -i app.example.eleven example11 blank --v2
And then run ionic serve to launch the blank app.
Now we are going to add a reference to the Platform class in example11/src/pages/home/home.ts. Update home.ts as follows:
import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
constructor(public platform: Platform) {}
}
And now we will start working with various features of the Platform class.
The first one...