Skip to content

Instantly share code, notes, and snippets.

@techiediaries
Last active September 21, 2016 15:46
Show Gist options
  • Select an option

  • Save techiediaries/61d00faf2910c2e12b55c22c8f689545 to your computer and use it in GitHub Desktop.

Select an option

Save techiediaries/61d00faf2910c2e12b55c22c8f689545 to your computer and use it in GitHub Desktop.
Installing and working with the Ionic 2 framework for building cross platform mobile apps with HTML,CSS and JavaScript(Angular 2)

Ionic is a hybrid mobile framework for building mobile apps using web technologies instead of native languages such as Java for Android and Swift for iOS.If you can build a static web app using JavaScript,HTML and CSS then you can build mobile apps too thanks to hybrid mobile frameworks such as Ionic .

Ionic uses Apache Cordova for accessing native device features ,uses SASS for styling and Angular.js.The most recent version of Ionic is Ionic 2 which's a completly rewritten framework that uses TypeScript instead of just plain JavaScript and uses Angular 2 instead of Angular.js.

Installing Ionic

First you need to download Node.js and install it.

whatever operating system you use,open your command line terminal and type the following lines

npm install -g ionic@beta

npm install -g cordova

You need to add @beta so you can install Ionic 2 (Which's still in beta to this time) instead of Ionic 1.

Creating an Ionic 2 project

Ionic 2 is still in beta.The Ionic cli uses both version 1 and 2 of Ionic so to scaffold an Ionic 2 project you need to add --v2 switch

ionic start firstApp --v2

Running and testing on the browser

With Ionic you can test your mobile app using and web browser with only one command

cd firstApp

ionic serve

Adding platforms

Before you can build your mobile app for a specific paltform(Android or iOS) you need to add these platforms

ionic platform add ios

ionic platform add android

You need to have a MAC to be able to add an iOS platform. For the build process to succeed you need to install the SDKs for each paltform you target.

Running on physical devices

You can run your app on physical devices you use:

ionic run ios

ionic run android

Building for Android

To be able to build for Android you need to install the Android SDK which means you need to have Java(1.8) installed on your system.

Ionic 2 and TypeScript

To be able to develop Ionic 2 based apps you need to be familiar with TypeScript,plain JavaScript is no more supported. TypeScript is a superset of EcmaScript 6 plus types.

Theming Ionic 2 apps

Unlike Ionic 1 ,Ionic 2 apps are more easier for theming ,you can find more informations here

References

Ionic 2 tutorial

Ionic 2 components.

Native Components.

Ionic tutorials

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment