by GeneralMaximus · 13y ago · 0 comments
If your backend exposes a textbook REST interface, integrating it with AngularJS is almost no work at all. $resource is all you need. In case you have one or two non-RESTful endpoints here and there – and honestly, who doesn't? – $http is your friend.
In an app I'm working on, I have a front-end built with Angular talking to a Tastypie back-end. Since Tastypie implements all the boring REST CRUD for you automagically, integrating the two took about fifteen minutes total.
If there are there any specific questions/issues on your mind, ask away.
Here's something I found while Googling around: https://github.com/dalcib/angular-phonecat-mongodb-rest. It doesn't use Django and Tastypie, but you may find at least the front-end code educational.
I personally completely separate my front-end and back-end code. So while the API is built with Django, the front-end doesn't go through Django at all. It's served straight through nginx without doing anything special except maybe some simple URL rewrites for prettier URLs.
If I'm not too tied up in college work this week, I might do a write up on Tastypie and Angular integration.
Do you know of any really good tutorials emphasizing Angular's $resource service?
Not really. I just used the official documentation. The egghead.io tutorials may touch on $resource. I also found this helpful: http://www.bennadel.com/blog/2433-Using-RESTful-Controllers-...
Some Googling turned this up: https://github.com/dalcib/angular-phonecat-mongodb-rest. It may help you.