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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s