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

Preface

Welcome to AngularJS with PhoneGap! In this book, you will receive practical knowledge about AngularJS and PhoneGap. In particular, you will learn how to build a complete, workable web app using AngularJS, after which you will convert various versions of this web app to a PhoneGap app. You should also pick up something new regarding PhoneGap in particular: how to use the command-line interface to generate PhoneGap apps.

What this book covers

Chapter 1, Introduction to AngularJS, will teach you the absolute basics of building an AngularJS app.

Chapter 2, Getting Ready for PhoneGap, will cover the PhoneGap command-line interface. By end of this chapter, you will have learned that the command-line interface is one of the best things about PhoneGap 3.x. The example you coded in Chapter 1, Introduction to AngularJS, will be put to use in this chapter.

Chapter 3, From a Simple To-do List to an Advanced To-do List, will cover some of the slightly more advanced concepts of AngularJS, such as code organization, making RESTful calls, and more. This advanced app will then be converted to a PhoneGap app.

Chapter 4, Adding Authentication Capabilities Using PhoneGap Plugins, will add Facebook authentication capabilities via PhoneGap plugins. Once again, you will see how we can add the Facebook plugin using the command-line interface.

Chapter 5, Sprucing Up the App Using Animations and Mobile Design, will cover a slightly more advanced AngularJS topic: animations.

Chapter 6, Getting Ready to Launch, will teach you how to launch the app, both in Android and iOS devices.

Appendix, References, has a list of references that you should find useful.

What you need for this book

This book assumes that you have a basic code editor. You will need a Mac if you intend to develop iOS versions of the PhoneGap app. You will most definitely require an Internet connection and the Google Chrome browser.

Who this book is for

This book is intended for people who are not familiar with AngularJS but have beginner experience in PhoneGap, and who might want to improve their PhoneGap skills by learning the command-line interface for PhoneGap 3.x, and develop PhoneGap apps using AngularJS.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Feel free to copy the code and save it as concepts.html."

A block of code is set as follows:

project/
   css/
   js/
      controllers/
            todo.js
      services/
            todo.js
      app.js
  partials/
     detail.html
     list.html
  index.html

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

<li ng-repeat="todo in todos">
  <input type="checkbox" ng-model="todo.done">
  <span class="done-{{todo.done}}">{{todo.text}}</span>
  <button ng-click="showDetail(todo.text)">Detail</button>
</li>

Any command-line input or output is written as follows:

cordova emulate android

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Click on Edit/Details for the Android item and start editing."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.