Components

Learn about the files that make up a component and how to create one using the Ionic CLI.

Now that we’ve learned about decorators and classes, let’s learn about components in detail.

Creating a new component

The following command creates a new page within the pages sub-directory of our app (if this sub-directory does not exist it will be created by the Ionic CLI):

ionic g page pages/<page-name>

We can prefix the page name with a directory, but it is not required (if this directory does not exist it will be automatically created by the Ionic CLI).

Try copying the following command into the terminal provided below to create an “About” page.

ionic g page pages/about

Get hands-on with 1400+ tech skills courses.