Skip to content

Angular 2 and Django too

I gave a talk at Djangocon earlier this week on Angular 2 and Django REST – not so much an intro to Angular 2 (you can go through a tutorial for that), but talking about why Angular 2 is something to pay attention to, plus looking at how you might use Angular 2 and a framework like Django REST together.

Why pay attention to Angular 2?

Three important points:

  • Deploy to any target
  • Choose your own language
  • Web components

Deploy to any target. Unlike Angular 1, Angular 2 doesn’t have a baked in conception of the DOM. That’s a really big deal! It means you can use Angular 2 in places without a concept of the DOM, such as building cross-platform apps with NativeScript. That’s awesome!

Choose your own language. Angular 2 is written in TypeScript, and the docs offer options for JS, TypeScript, and Dart. So I dare say that you could use Angular 2 with any language (as long as it can compile to JavaScript!). This has been true of other frameworks (ex. Om, the ClojureScript version of React), but I’ve never seen such a thing in a framework’s own documentation. Pretty fascinating.

Web components. Web components are awesome! But … the browser standards aren’t quite there. Angular 2’s components are meant to be future-forward compatible with web components (when we eventually get them), so you can start using this architecture today in the context of a framework that’s performant.

Django REST

The last API I built in Django was using Tastypie, but for this talk I wanted to use Django REST since it’s gaining steam in the Django community. And wow, is that thing pretty cool! With fairly little configuration, you get a web-browseable API, with all the methods working (GET, POST, DELETE, etc.). The quickstart tutorial is nice and fast, so check it out!

You can see the slides online, and check out the example project on Github.

6 Replies to “Angular 2 and Django too”

  1. Hi, this is my first year in the software development world and I have been doing Django Rest and Angular1 for a few months now and I want to move to Angular2 but I have been searching for Django + Angular2 for weeks and I couldn’t find anything. can you please send me a link to your talk or to any resource that can help me please.

  2. It doesn’t display any of the dinosaurs added in django rest in angular app, I don’t know if I have done sth wrong or if I didn’t do sth necessary.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.