How to do it...

The following are the instructions for lazy loading:

  1. Create a new app LazyLoading using the blank template and navigate to the Lazy Loading folder, as follows:
$ ionic start LazyLoading blank$ cd LazyLoading
  1. Create a new file named home.module.ts inside the /src/pages/home folder, and add the following content to it:
import { NgModule } from "@angular/core";import { IonicPageModule } from "ionic-angular";import { HomePage } from "./home";@NgModule({ declarations: [HomePage], imports: [IonicPageModule.forChild(HomePage)]})export class HomePageModule {}
  1. Add the IonicPage decorator to the HomePage's Component, as follows:
import { Component } from "@angular/core";import { NavController, IonicPage } from "ionic-angular"; ...

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.