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

Connecting Parse to our project


In order to connect the Parse data to our project, we will need to create an AngularJS service that performs the necessary CRUD operations to interact with the Parse REST API.

The code editor of our choice is Atom, the GitHub open source editor. Start by adding the project folder to Atom by navigating to it:

File | Add Project Folder

Create a file named services.js with the following path:

www | js | services.js

Start by connecting the services. Define the service as follows:

angular.module('ionictodo.services',[]).factory('Todo',['$http',function($http){
  return {

  }
}]);

At this stage, our factory object Todo is an empty object, and we will need to add the necessary Parse.com API methods to it. It's important to note that the hostname is https://api.parse.com in all cases. /1/ means that we are using version 1 of the API.

The following is the factory object with the five required methods:

angular.module('ionictodo.services',[]).factory('Todo',['$http','PARSE_CREDENTIALS...