Book Image

PhoneGap and AngularJS for Cross-platform Development

By : Yuxian E Liang
Book Image

PhoneGap and AngularJS for Cross-platform Development

By: Yuxian E Liang

Overview of this book

PhoneGap is a mobile development framework that allows developers to build cross-platform mobile applications. Building PhoneGap apps is traditionally done using HTML, CSS, jQuery Mobile, Eclipse Editor, and/or Xcode. The process can be cumbersome, from setting up your editor to optimizing your usage of jQuery, and so on. However, AngularJS, a new but highly popular JavaScript framework, eases these tasks with APIs to get access to mobile APIs such as notifications, geo-location, accelerometers, and more. Starting with the absolute basics of building an AngularJS application, this book will teach you how to quickly set up PhoneGap apps using the command-line interface. You will learn how to create simple to advanced to-do lists and add authentication capabilities using PhoneGap's plugins. You will enhance your skills by writing a PhoneGap app using your newly learned AngularJS skills. Furthermore, you will learn about adding animation and interactive designs to your mobile web apps using PhoneGap plugins. By the end of the book, you will know everything you need to launch your app on both Android and iOS devices.
Table of Contents (14 chapters)
PhoneGap and AngularJS for Cross-platform Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Command-line interface for both Android and iOS


Once you have finished installing the individual platforms, it's time to move on to the command-line interface. This section contains the most important commands for the command-line interface. To start off, you need to install Node.js (www.nodejs.org). Once you have installed node.js, perform the following steps:

  1. Run the npm –g install cordova command. This installs the command-line interface on your computer.

  2. Change the directory to the place where you will be saving your project files for this chapter.

  3. Once in the directory, issue the cordova create todo com.project.todo ToDo command. This will create a folder containing your basic files for PhoneGap.

  4. Now, change directory to /todo.

  5. Once in the directory, we need to install the various platforms we will be supporting:

    • For iOS, use the cordova platform add ios command

    • For Android, use the cordova platform add android command

  6. Now, let's try to run the Hello World example in Android using the cordova...