Book Image

Ionic Cookbook

By : Hoc Phan
Book Image

Ionic Cookbook

By: Hoc Phan

Overview of this book

Table of Contents (18 chapters)
Ionic Cookbook
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

The world of mobile development is fragmented, with many platforms, frameworks, and technologies. Ionic is intended to fill this gap with its open source HTML5 mobile app framework that lets developers build native-feeling apps using web technologies such as HTML, CSS, and AngularJS. Ionic makes it easy for frontend developers who want to become app developers. The framework provides superior performance with deep Cordova integration and a comprehensive set of tools for prototyping, backend support, and deployment.

This book will take you through the process of developing a cross-platform mobile app using just HTML5 and JavaScript based on Ionic. You will start first by getting familiarized with the CLI and learning how to build and run an app. You will have a look at some common features of real-world mobile apps such as authenticating a user and receiving and saving data using either Firebase or Local Storage.

Next, the book will explain how Ionic integrates with Cordova to support native device features by using ngCordova and takes advantage of the existing modules around its ecosystem. You will also explore the advanced topics related to extending Ionic to create new components. Finally, the book will show you how to customize the Ionic theme and build the app for all platforms.

What this book covers

Chapter 1, Creating Our First App with Ionic, introduces the Ionic framework and provides instructions for setting up the development environment and quickly creating and running the first app.

Chapter 2, Managing States and Navigation, walks through some examples of how to manage views, states, and the overall navigation within the app. This can be done via either the UI-Router component of AngularJS or the out-of-the-box Ionic directives.

Chapter 3, Adding Device Features Support, explains how to use ngCordova to access native device functionalities such as the camera (photo and video), the contact list, e-mail, and map.

Chapter 4, Offline Data Storage, explains how to work with persistent data when the device is offline. You will understand the advantages and disadvantages of using Local Storage versus SQLite.

Chapter 5, Handling Gestures and Events, explains how a touch event works and how to process these events to create a better interaction or a custom component.

Chapter 6, App Theme Customization, provides instructions on how to customize an app for different platforms and create an introduction screen for your own branding.

Chapter 7, Extending Ionic with Your Own Components, takes a deep dive into the AngularJS directive and filter customization. You will learn how to leverage events from the core Ionic components and use requestAnimationFrame for an improved animation performance.

Chapter 8, User Registration and Authentication, explains the different methods that can be used to authenticate a user and how the Firebase authentication system works.

Chapter 9, Saving and Loading Data Using Firebase, walks through some examples, such as those related to storing and retrieving data, using Firebase as the backend. Also, you will learn how to manage and render large datasets.

Chapter 10, Finalizing Your Apps for Different Platforms, provides instructions for performing the final steps of getting an app published.

What you need for this book

You need the following to work with the examples in this book:

  • A Mac computer with Mac OS X Yosemite and root privilege

  • Or a PC with Windows 7 or later with Administrator privileges

  • iPhone 5 or later

  • An Android device with Android 5.x or later (optional)

  • A Windows phone device (optional)

Who this book is for

Ionic Cookbook is intended for frontend developers who want to take advantage of their existing skills to develop cross-platform mobile apps. This book will help you become an intermediate or advanced Ionic developer by covering in-depth topics about AngularJS, Cordova, and Sass. Since Ionic is open source, there is a large community that supports this framework for you to continue the learning journey.

Sections

In this book, you will find several headings that appear frequently (Getting ready, How to do it, How it works, There's more, and See also).

To give clear instructions on how to complete a recipe, we use these sections as follows:

Getting ready

This section tells you what to expect in the recipe, and describes how to set up any software or any preliminary settings required for the recipe.

How to do it…

This section contains the steps required to follow the recipe.

How it works…

This section usually consists of a detailed explanation of what happened in the previous section.

There's more…

This section consists of additional information about the recipe in order to make the reader more knowledgeable about the recipe.

See also

This section provides helpful links to other useful information for the recipe.

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: "Ionic Creator allows the user to export everything as a project with all .html, .css, and .js files."

A block of code is set as follows:

{
  "name": "myApp",
  "app_id": "",
  "watchPatterns": [
    "www/**/*",
    "!www/css/**/*",
    "your_folder_here/**/*"  
  ]
}

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

$ ionic start HelloWorld_Blank blank

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: "Once completed, click on the Export button on the top navigation."

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.