4

One of the features hawked by AngularJS aficionados is the two-way data binding between DOM contents and JavaScript data that the framework offers.

I'm presently working on a couple of learning projects integrating AngularJS and Django, and one of the pain points is that the problem AngularJS solves between data in JavaScript and DOM representation is not immediately solved for the pairing of AngularJS and Django. Ergo, coordinating AngularJS and Django (AFAICT as an AngularJS novice) involves the kind of programming that is common in jQuery DOM manipulations and Angular seems to be written to obviate the need for. This is great for learning, but leads me to ask, "Has anyone tried to do for AngularJS + Django what AngularJS and Django individually offer to developers, namely obviating the need for this kind of stitching-up code?" AngularJS is more explicit about "Let two-way binding do the work," but Django as "the web framework for perfectionists with deadlines" seems intended to decrease manual labor.

At present I am building JSON to send to the client, but I was wondering if there were any projects to reconcile AngularJS to Django.

Christos Hayward
  • 5,777
  • 17
  • 58
  • 113

2 Answers2

1

You might want to have a look at : https://github.com/jrief/django-angular In their presentation, they give an example of three-way data binding: http://djangoconf.aws.awesto.com/slides.

This is being performed with a combination of ajax calls (from angularjs to django) and websockets (from django to angularjs).

Luke Skywalker
  • 1,464
  • 3
  • 17
  • 35
0

JSON is the way to go. I would look at libraries like Tastypie and Django REST framework to alleviate the amount of code to write.

Bigcortex
  • 145
  • 5