Drupal is great for content management (CMS), but slow for rich internet applications (RIA). This is where AngularJS shines really bright. Wouldn't it be great if you could marry the two and create RIA's that leverage Drupal's awesome CMS capabilities, users, roles, permission, analytics, views, display-suite, theming etc. combined with Angular's in-browser MVC. Add to that Angular's AJAX calling Drupal's RESTful JSON webservices (restws module) and you've got best of both worlds. And not to forget security, we'll make sure all AJAX requests are authenticated and authorized by Drupal.

In effect, what you have is an island of (AngularJS) application in an ocean of (Drupal) content.

This presentation will walk you through the process of creating an AngularJS app combined with a Drupal module that implements the above functionality.

  1. Injecting ng-app and ng-view into your Drupal pages.
  2. Importing angular.js and other JS / CSS libraries into your Drupal pages.
  3. Invoking Drupal's own RESTful services from the Angular app.
  4. Invoking externally developed RESTful services from the Angular app.
  5. Passing authentication token -- JWT (JSON Web Token) -- from Drupal to external RESTful backend, and validating it.
  6. Injecting ng-view to load routes and partials into your Drupal pages.
  7. Handling cross-origin AJAX request issues (CORS).
  8. Making your Angular app usable outside of Drupal.

Sponsors