Ionic 2 Framework: Add new Page

To add new ionic 2 page, you can use CLI commands. Now let’s try to add new page in the root page.

In your terminal or cmd use the ionic CLI

It will automatically create folder with all the files needed. You can check it in ./src/pages/new-place

Open new-place/new-place.html then we add button to it.

We add a button and put click trigger on it which refer to the function onLoadNewPlace() which we will be creating. ion-button will simply add native ionic button style.

Open home/home.ts and we add the function onLoadNewPlace().

We imported what we created in new-places then added the function which push the page.

Make sure to add the newly created page in the app/app.module.ts

Make sure that you have imported it. So below the imports add

Now when you click the button it will bring you to the new page.

credits to Academind

Sharing is caring!