Platform service

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 ...

Get Learning Ionic - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.