Blog

Getting Started with Ionic 2

Getting Started with Ionic 2

In this post we will discuss on how to install and create basic Ionic 2 app from scratch; including installing prerequisite applications.

Node.js

Before you can install Ionic 2, you will need Node.js 6 or later version to installed on you system. Visit the installation page and select the installer based on your operating system.

Please note that Node Package Manager (npm)  should be installed prior to initiate with ionic 2, don’t worry it is enabled by default by the node.js installer.

Now we are ready proceed to the next step.

Console

Make sure that you have installed console, I use gitbash which can be downloaded from this page.

Installing Ionic & Cordova

Type the following command into the console:

$ npm install -g ionic cordova

The command is only to be run once on your operating system as long as -g (global) flag is used to download and install Ionic CLI (Command Line Interface) and along with Cordova, which is need to build and deploy app natively.

Now we are ready to create our Ionic app

Creating First Ionic 2 Project

Now type the following command into your console window:

$ ionic start myapp blank --v2

Let’s discuss what we just type in the console window:

  1. ionic – This is how you access Ionic CLI and issue to it certain commands.
    • If you just hit “ionic” and hit enter, it will show ionic version information along with available commands.
    • If you hit “ionic -h”, it will return all commands along with there description and with there arguments.
  2. start – This command will be used by CLI for starting a new project.
  3. myapp – This is the name given to your application and the folder in which app will reside, this phrase can be any word. Ionic CLI will generate all basic and necessary files into this folder.
  4. blank – This command is optional. Ionic CLI use this command to create an app from the available templates. The available options are tabs, sidemenu and tutorial
  5. –v2 – This flag restrict Ionic CLI to create an app based on version 2, If left out, Ionic CLI will create an app with Ionic version 1, which obviously not required at all.

Now we will browse to our app folder by typing this command into console

$ cd myapp

Now we are ready to serve our created Ionic 2 app

Serve Ionic 2 App

We will type the following command to serve Ionic 2 app into console:

$ ionic serve

That’s it, see you there in our next tutorial.

Leave a Reply

Your email address will not be published. Required fields are marked *

Have questions? We are there to assist you any time.