Generating components

The ionic generate command create new pipes, components, pages, directive and providers. Also, this will create entry inside you app.module.ts for example if you create have created a provider it will be imported in app.module.ts and injected in providers. Once you create any of the page, component, directive, or pipe you will see a folder create with it TypeScript file where you can now start writing your logic:

$ ionic generate [type] [name]
  • [--type]: Type of generator such as page, directive, and pipe
  • [--name]: Name of the component generated
// Some example commands$ ionic generate pipe NumberPipe$ ionic generate page About

Get Hybrid Mobile Development with Ionic 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.