How it works...

We already used multiple Ionic pages in the navigation, so we know that push/pop navigation works. Let's take a closer look at how we define an Ionic Page as follows:

@Component({ selector: 'page-contact', templateUrl: 'contact.html'})export class ContactPage {}

You can see that an Ionic page is actually an Angular component, and we already know that we can use components as an HTML element using their selector. In the preceding example, selector of the page is page-contact. So technically we can use the selector in HTML. But it becomes a problem if our page is getting data from the previous page using NavParams. Let's take a look at the constructor of ContactPage, shown in the following code block:

 constructor(public navCtrl: ...

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.