drupal8 + angularjs

43
BEGINNERS GUIDE TO SPA WITH DRUPAL + ANGULARJS

Upload: daniel-kanchev

Post on 06-Apr-2017

274 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Drupal8 + AngularJS

BEGINNERS GUIDE TO SPA WITH

DRUPAL + ANGULARJS

Page 2: Drupal8 + AngularJS

Daniel KanchevDrupal Enterprise Hosting Manager

@dvkanchev

Page 3: Drupal8 + AngularJS
Page 4: Drupal8 + AngularJS
Page 5: Drupal8 + AngularJS
Page 6: Drupal8 + AngularJS

ApplicationsSingle Page

Page 7: Drupal8 + AngularJS

WHAT IS A SINGLE PAGE APPLICATION?

Page 8: Drupal8 + AngularJS
Page 9: Drupal8 + AngularJS

BEFORE SPA - Web 2.0- RIAs- Flash, SilverLight - AJAX

Page 10: Drupal8 + AngularJS

AJAX:Technology or Generator of

many issues?

Page 11: Drupal8 + AngularJS

Crawling scheme:http://domain.com/#products/please-crawl-me-here

Page 12: Drupal8 + AngularJS

New JS Engines - 20081. Chrome V8 Engine

2. Safari Nitro Engine 3. Firefox - TraceMonkey

Page 13: Drupal8 + AngularJS

JS Frameworks - 20101. BackboneJS 2. AngularJS

3. React

Page 14: Drupal8 + AngularJS

Web innovations- 2012/13

1. HTML 5 - push state 2. CSS 3 - transitions, media queries

Page 15: Drupal8 + AngularJS

Google Blog October 14, 2015

“Deprecating our AJAX crawling scheme”

Page 16: Drupal8 + AngularJS

SPA Advantages1. Segregation —> Good API 2. Performance —> Caching 3. Better UX 4. HA Setup and Failover

Page 17: Drupal8 + AngularJS

HTTP REQUEST

HTTP RESPONSE

- Internal Server Error - Service Unavailable - Gateway Timeout

Page 18: Drupal8 + AngularJS

HTTP REQUEST

HTTP RESPONSE

- Local ISP Issue - DNS Issues - Internet Routing Issues

Page 19: Drupal8 + AngularJS

HTTP REQUEST

HTTP RESPONSE

- Angular Retry Request - Failover to another API version - Failover to another API instance - Failover to another geo region

API

Page 20: Drupal8 + AngularJS

API 1 API 2

API 3

2.3

3.4

0.8

MEXICO

Page 21: Drupal8 + AngularJS

API 1

API 2

API 3

CDN

Page 22: Drupal8 + AngularJS

RecapApplications

Single Page

Page 23: Drupal8 + AngularJS

SPA Overview/History SPA Advantages SPA Architecture

Page 24: Drupal8 + AngularJS

AngularJSOverview of

Page 25: Drupal8 + AngularJS

Remember document.getElementById()?var hello = “Hey, jQueryTO!”;

<div id=“message”></div> document.getElementBy(‘message’).textContent = hello;

<div id=“message”></div> $(‘’#message).text( hello );

<div>{{hello}}</div>

Old school way to dynamically update text:

Then that was replaced by $(selector):

And now with AngularJS:

Page 26: Drupal8 + AngularJS

jQuery Version

Page 27: Drupal8 + AngularJS

AngularJS Version

Page 28: Drupal8 + AngularJS

HTML

CSS

JavaScript

Services

VIEW MODEL

CONTROLLER

Drupal 8 APIUsers

Page 29: Drupal8 + AngularJS

AngularJS Controllers

http://plnkr.co/edit/jIDk4ygbQPC0cVjNEhTu?p=preview

Page 30: Drupal8 + AngularJS

AngularJS Features1. Two way data binding 2. Templates 3. Directives 4. Expressions 5. Filters

Page 31: Drupal8 + AngularJS

RecapAngularJS

Overview of

Page 32: Drupal8 + AngularJS

The web before AngularJS AngularJS MVC

AngularJS Features

Page 33: Drupal8 + AngularJS

Drupal 8 API+

AngularJS

Page 34: Drupal8 + AngularJS

Drupal 8 Setup• Install the needed modules

Page 35: Drupal8 + AngularJS

Drupal 8 Setup• Set permissions for CRUD methods

Page 36: Drupal8 + AngularJS

Drupal 8 Setup• Test retrieving an article with GET in JSON format

Page 37: Drupal8 + AngularJS

LIVE DEMO

Page 38: Drupal8 + AngularJS

Recap

Drupal 8 API+

AngularJS

Page 39: Drupal8 + AngularJS

QUESTIONS ?

Page 40: Drupal8 + AngularJS

Resources:http://www.angularjsbook.com/ https://goo.gl/9o6rJK - AngularJS vs. Angular2 https://goo.gl/CcBW4g - AngularJS + Drupal 8 YouTube tutorial https://goo.gl/0RV07I - DrupalCon LA session http://goo.gl/mwhJ2x - drupalize.me tutorialhttp://goo.gl/WsYTnV - RESTful services docs

Page 41: Drupal8 + AngularJS

Custom REST resources in D8:1. goo.gl/BY3zYf - How to create a Rest Resource in Drupal 82. goo.gl/kCqG20 - GitHub repo related to the above blog post

Page 42: Drupal8 + AngularJS

http://slideshare.net/DanielKanchev

Page 43: Drupal8 + AngularJS

THANK YOU!@dvkanchev

[email protected]