How to do it...

Observe the following instructions:

  1. Create a new SharedService app using the blank template as shown and go to the SharedService folder:
$ ionic start SharedService blank
$ cd SharedService
  1. You will need to make several changes in the directory because you have two pages and a common service for both. Let's start by modifying the ./src/app/app.component.ts file so that the rootPage is pointing to Page1:
import { Component } from '@angular/core';import { Platform } from 'ionic-angular';import { StatusBar } from '@ionic-native/status-bar';import { SplashScreen } from '@ionic-native/splash-screen';import { Page1 } from '../pages/page1/page1';@Component({  templateUrl: 'app.html'})export class MyApp { rootPage:any = Page1; ...

Get Ionic Cookbook - Third 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.