Tag Archives: Generator

Ionic Generator Function

I had no idea there was a generator function in Ionic 2 until this week.  It’s a pretty handy command line function that generates page and service stubs inside your app automatically.

Rather than manually creating js, html and scss files  in your editor (I use Atom by the way), you can quicken the process up a little by using the generate command like this:

ionic g page contactsPage

This will automatically create the following pages for you:

app/pages/contacts-page/contacts-page.html

app/pages/contacts-page/contacts-page.js

app/pages/contacts-page/contacts-page.scss

If you type:

ionic g –list

you will see the list of available options which currently includes components, providers and a few others.  I expect the list will grow as the framework evolves.

 


I’m a mobile applications developer based in the UK, concentrating primarily on hybrid application development with Ionic and Ionic 2 but also with native development skills. Please visit www.crossplatformsolutions.co.uk for more information about me and how I may be able to help you with mobile application development, particularly with Ionic 2 but also with other mobile frameworks and technologies.  Thanks for visiting.