Drupal-Angular Hybrid Apps

2015-04-14

Jitesh Doshi

Drupal-Angular Hybrid Apps

Presentation overview on building applications that leverage both Drupal CMS and AngularJS frontend.

On April 11, 2015, I gave a presentation at Florida Drupal Camp about writing applications that leverage the power of both Drupal and AngularJS.

Drupal is great as a content management system (CMS) and user management, authentication, authorization etc. along with layouts and rules; while AngularJS is an in-browser, client side MVC framework.

We can always use Drupal or any other REST platform as server-side backend for our AngularJS application. Hence we can use third-parties to provide non-core and non-CMS functionality - such as payment processing, templated bulk- and transactional-emails.

  • Model (application data) is fetched from server-side restful services and it is transferred over JSON via AJAX requests to and fro.
  • View (Single Page) is the page with static HTML partials (templates) transferred over AJAX which doesn’t actually contain any data and is required to load only once (therefore highly cacheable)
  • Controller is the front-end / UI logic in JavaScript. It handles all navigation, validation, AJAX request and user interaction.

This approach results into a simpler backend as all we have to write is a function that fetches data and returns data and has nothing to do with presentation layer, while front end deals with static HTML partials (templates) only.