Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

ionic Installation

ionic Installation

The examples on this site use ionic v1.3.2, with the CDN library address:







ionic latest version download address:http://ionicframework.com/docs/overview/#download。

After downloading, unzip the package, which contains the following directories:



css/               =>     样式文件

fonts/             =>     字体文件

js/                =>     Javascript文件

version.json       =>     版本更新说明

You can also download the following resource files on Github:https://github.com/driftyco/ionic(in the release directory).

Next, we only need to import the css/ionic.min.css and js/ionic.bundle.min.js files from the above directories in the project to create an ionic app.

Example

<

ion-header-bar

class

=

"

bar-positive

"

<

h1

class

=

"

title

"

Hello World!

h1

ion-header-bar

<

ion-content

<

p

My First ionic App.

p

ion-content

Try it »

Click the "Try it" button to view the online example.

This tutorial focuses on the application of the ionic framework; most examples run in the browser, and running on mobile devices can be learned in detail in the following command-line installation tutorial.

**Note:** in mobile apps such as phonegap we only need to add the corresponding js and css files to the resource library.


Install from the command line

First you need to install Node.js, we will need to use its NPM tool in the following installation; for more NPM introduction, see ourNPM Usage Introduction。

Then throughcommand line toolinstall the latest version of cordova and ionic. By referring toAndroid and iOS official documentation to install.

On Window and Linux, open a command-line tool and execute the following command:



$ npm install -g cordova ionic

On Mac systems, use the following command:



sudo npm install -g cordova ionic

If you have already installed the above environment, you can execute the following command to update the version:



npm update -g cordova ionic

or



sudo npm update -g cordova ionic

to Create an Application

Create an ionic app using a ready-made application template provided by ionic officially, or a blank project:



$ ionic start myApp tabs

Run the ionic project we just created

Use the ionic tool to create, test, and run your apps (or create directly through Cordova).

Creating an Android App



$ cd myApp

$ ionic cordova platform add android

$ ionic cordova build android

$ ionic cordova emulate android

If everything goes well, the emulator will pop up, with the interface as follows:

Creating an iOS App



$ cd myApp

$ ionic cordova platform add ios

$ ionic cordova build ios

$ ionic cordova emulate ios

If the "ios-sim was not found." error occurs, you can execute the following command:

npm install -g ios-sim

If everything goes well, the emulator will pop up, with the interface as follows:


Ionic Lab

Ionic Lab has stopped being updated.

Ionic Lab is a desktop development environment; if you don't like using the command line, Ionic Lab will meet your needs.

Ionic Lab provides developers with a simpler way to start, compile, run, and simulate Ionic applications.

Platforms supported by Ionic Lab are: Window, Mac OS X, Linux, download address:http://lab.ionic.io/, just install directly after downloading. The whole interface is as follows:

Through the above interface you can perform the following operations:

Sublime Text is recommended as the editor for Ionic projects; we can open the project directly in Sublime Text through Ionic Lab, as shown below:

![](https://www.runoob.com/wp-content/uploads/2015/08/ionic-sublime.png)

Gif operation demo