您的位置:首页 > 其它

First touch of Ionic 2

2016-05-10 15:08 141 查看
Please note that we use Ubuntu/Debian in this blog.

Resume

Ionic 2 is a useful SDK for hybird mobile app development (which means that you can produce your app on different platform). With ionic 2, we can simply build app on Android/iOS/Windows Phone(Hasn’t been released officially until now) without major modifications. Ionic 2 is based on AngularJS 2 and web technologies such as HTML, CSS and SASS (Which is a pre-compile CSS format).

Install

To install ionic, you should have NodeJS and npm first.

Here we suppose that you already have your NodeJS and npm, then just type

npm install -g ionic@beta


in your terminal to install ionic 2.

Hello World! and build

To create a project, just type

ionic start HelloWorld --v2


in your terminal. After typing the command above, ionic will automatically generate a standard project.

Then you can just type

ionic serve


to build the project as well as run it on the browser.

As Ionic 2 is a hybrid app development SDK, you can also build app on Android and iOS by typing

ionic build android


or

ionic build android
.

Please note that you can also add
--v2
to force using Ionic 2 for you compilation and also add
--ts
to enable TypeScript support.

Attention: Only computer with Mac OS can build iOS app. To build and deploy your project, you MUST have corresponding SDK.

Tips: To install Android SDK, you can simply install an Android Studio on your computer to manage SDK.

Test your project

In order to test your project easily, you can use
ionic run android
to deploy your app on your Android device as well as you can type
ionic run ios
to deploy on your iOS device.

Also, you can add a parameter
--device=YOUR_DEVICE_ID
to specify a device that you want to deploy your app.

For instance:
ionic run android --device=abcd00000


Tips: You can install adb by typing
sudo apt-get install adb
to list devices that are connected to your computer.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: