Book Image

Learning Node.js for Mobile Application Development

Book Image

Learning Node.js for Mobile Application Development

Overview of this book

Table of Contents (21 chapters)
Learning Node.js for Mobile Application Development
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
14
Creating an E-Commerce Application Using the Ionic Framework
Index

Accessing the device data


Now that the basics of our app are have been implemented, it is time to add some serious data to it. In our case, we want to load the contacts stored on the device that our app is running on so that we can show them in the list that we created earlier.

Accessing native services

You may recall that Ionic is built on top of the Cordova platform, which provides the core interaction with the underlying operating system and hardware. In order to access native services, such as the contact list, we will frequently have to make use of Cordova directly.

In this particular case, we are in a very easy spot; Cordova not only has a full-fledged plugin to interact with the contacts, but also sports a very convenient CLI method to install it.

Go to your project directory and run the following from a terminal or command line:

cordova plugin add org.apache.cordova.contacts

This will install the Cordova Contacts plugin, which will be placed in the following folder:

plugins/org.apache...