01 Okt

Ionic 3 | Getting started

Requirements

You need node.js and npm. Look here for how to install this things.

Install cordova and ionic

$ npm  -g install cordova
$ npm  -g install ionic

Check installation

$ cordova telemetry off
You have been opted out of telemetry. To change this, run: cordova telemetry on.
$ cordova --version
6.4.0

$ ionic --version
2.1.4

Create your first application

List available templates

$ ionic start --list

Create a sample tabs app

$ mkdir ionic
$ cd ionic/
$ ionic start helloworld tabs -ts

Output of command:

Creating Ionic app in folder /home/vagrant/ionic/helloworld based on tabs project
Downloading: https://github.com/driftyco/ionic-app-base/archive/master.zip
[=============================]  100%  0.0s
Downloading: https://github.com/driftyco/ionic-starter-tabs/archive/master.zip
[=============================]  100%  0.0s
Installing npm packages...

...

♬ ♫ ♬ ♫  Your Ionic app is ready to go! ♬ ♫ ♬ ♫

Some helpful tips:

...

Run

$ ionic serve

Output:

Running live reload server: http://localhost:35729
Watching: www/**/*, !www/lib/**/*, !www/**/*.map
√ Running dev server:  http://localhost:8100
Ionic server commands, enter:
  restart or r to restart the client app from the root
  goto or g and a url to have the app navigate to the given url
  consolelogs or c to enable/disable console log output
  serverlogs or s to enable/disable server log output
  quit or q to shutdown the server and exit

Result ist displayed in a browser:

ionic serve helloworld

Add support for mobile platforms

$ ionic add ios
$ ionic add android

Run on platform emulator

ionic emulate ios
ionic emulate android

Specify image to use (avd name)

ionic emulate android --target 6