Book Image

Ionic Cookbook - Third Edition

By : Singh
Book Image

Ionic Cookbook - Third Edition

By: Singh

Overview of this book

Ionic is the preferred choice for JavaScript developers to develop real-time hybrid applications. This book will get you started with Ionic 3.9 and help you create Angular 5 components that interact with templates. You will work with Ionic components and find out how to share data efficiently between them. You'll discover how to make the best use of the REST API to handle back-end services and then move on to animating your application to make it look pretty. You then learn to add in a local push notification in order to test the app. Then you'll work with Cordova to support native functionalities on both iOS and Android. From there, you'll get to grips with using the default themes for each platform and customizing your own. We then take you through the advanced Ionic features like lazy loading, deep linking, localizing ionic apps etc. Finally, you'll see how best to deploy your app to different platforms. This book will solve all your Ionic-related issues through dedicated recipes that will help you get the best out of Ionic.
Table of Contents (12 chapters)

Taking a photo using the camera plugin

In this section, you will make an app to take a picture using the device camera or load an existing picture from the device album. The picture could be either in the Base64 format or saved in a local filesystem relating to your app. The following is a screenshot of the app:

Here is the high-level process:

  1. Access the Cordova camera plugin to trigger camera capture and get the image back in the Base64 or URI format
  2. Parse the Base64 data or URI on an <img> DOM object
  3. Display the URI if it's in the URI format
  4. Capture an event of a toggle component
  5. Display long data (for example, URI) using a horizontal scroll

Getting ready

You should have a physical device ready in order to...