Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you use AngularJS with Parse.com?

I am new to phonegap development & I am trying to pick a framework to use. I'd like to use AngularJS as I've read good things about it, but I'd like it to work with Parse.com as a backend. I noticed that one Parse.com they don't specify any compatibility with Angular, and all their documentation and Javascript API requires Backbone.

I know AngularJS supports http, so I can communicate with Parse using the REST API. But is this going to end up being a mess & will I save myself time & stress if I use Backbone with the Parse.com Javascript API instead?

like image 625
cjm2671 Avatar asked Sep 01 '13 08:09

cjm2671


4 Answers

I have not worked on Parse, but I believe as long there is a REST API available AngularJS can very well integrate with Parse.com. These links substantiate that fact

https://parse.com/questions/does-any-know-of-any-angularjs-sites-that-are-built-with-parse-that-are-open-source

http://brandid.github.io/parse-angular-demo/#/

Said that, AngularJS is a very capable framework with a steep learning curve. The simple stuff is simple but one needs to put ones head down and start learning the not so simple stuff like directives once one starts building any decent size application. The more you invest in learning AngularJS the more rewarding it becomes.

It has a very clean separation in terms of view and code. The code is further organized into modules, factories, services, controllers, directive, filters etc.

But still nothing stops you from creating a mess with the implementation :) What I have realized over the time is even if you create mess within AngularJS the effects are localized rather than affecting the complete application, due to the modular nature of Angular.

I suggest you try creating or looking at some samples with AngularJS (such as TodoMVC)

This is how i felt learning and implementing AngularJS solutions enter image description here

like image 150
Chandermani Avatar answered Oct 20 '22 05:10

Chandermani


Thanks for bring up our Parse x AngularJS boilerplate - we've just updated it today too.

Our entire site getbrandid.com is built with Parse x AngularJS and no servers of our own.

We built this boilerplate after because having spent a few years building BRANDiD, we had a lot of best practices to share with the Parse and AngularJS communities. We think it is a match made in heaven, and is the fastest way to build powerful complex, highly maintainable serverless apps.

We've basically extended the Parse SDK to support AngularJS bindings, we've eliminated a ton of boilerplate code, and most importantly, we've established an architecture for large serverless apps using Parse and Angular.

I highly encourage you to check it out -

Parse x AngularJS Boilerplate

like image 23
arush_try.com Avatar answered Oct 20 '22 04:10

arush_try.com


Actually Parse's documentation does not say that you have to use Parse with Backbone, it just says that some stuff are compatible with Backbone classes, like the Collections object, which might be useful ONLY IF you use Backbone.

The big hassle of using 3rd party stuff inside angular is its lifecycle, as it uses POJOs and only watches for changes in these objects at specific points in time - Check the Scope Life Cycle documentation for more info.

Given that, when Parse returns its callbacks, AngularJS might no longer be observing those Parse objets, so you need a way of telling angular that thing changed, and you have to do it inside the digest loop, for example using $scope.$apply

I created a small wrapper for Parse.Query and Parse.Object to avoid the need for $scope.$apply all the time, let me know if you find it useful: https://github.com/felipesabino/angular-parse

like image 11
Felipe Sabino Avatar answered Oct 20 '22 03:10

Felipe Sabino


The easiest way I found to communicate with the parse.com backend is to use the jimrhoskins/angular-parse Angularjs module that replaces the (backbone) ParseSDK.

Ads instant :-) I included it in this angular/parse boilerplate.

like image 1
Jonathan Avatar answered Oct 20 '22 05:10

Jonathan