Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Showcase: De Kust www.extradeluxe.be

daanporon
April 09, 2014

Showcase: De Kust www.extradeluxe.be

We’ll show you how we created the visual experience of De Kust Extra Deluxe (www.extradeluxe.be). An interesting project that showcases the power of AngularJS for creating immersive campaign websites. We’ll explain how we used promises to control the flow of the application and how we implemented html5 pushState and content versioning.

On April 9th 2014 we've shared our experiences in AngularJS with the Belgian AngularJS meetup group. 72 people joined us to see what we had to say. In case you missed it, don't worry you'll find everything you need here: http://bit.ly/angularmeetup

daanporon

April 09, 2014
Tweet

More Decks by daanporon

Other Decks in Programming

Transcript

  1. Promises A promise represents the eventual result of an asynchronous

    operation. It can have three states: pending, resolved, rejected http://docs.angularjs.org/api/ng/service/$q
  2. Animations angular.module('tvlKustApp') .constant('videos', { 'main': ['intro', 'loop'], 'de-panne': ['zoomIn', 'loop',

    'zoomOut'], 'blankenberge': ['zoomIn', 'loop', 'zoomOut'], 'bredene': ['zoomIn', 'loop', 'zoomOut'], 'de-haan': ['zoomIn', 'loop', 'zoomOut'], 'knokke': ['zoomIn', 'loop', 'zoomOut'], 'koksijde': ['zoomIn', 'loop', 'zoomOut'], 'middelkerke': ['zoomIn', 'loop', 'zoomOut'], 'nieuwpoort': ['zoomIn', 'loop', 'zoomOut'], 'oostende': ['zoomIn', 'loop', 'zoomOut'], 'zeebrugge': ['zoomIn', 'loop', 'zoomOut'], 'competition': ['zoomIn', 'loop', 'zoomOut'] });
  3. Route resolve angular.module('tvlKustApp') .constant('routes', { 'main': { 'route': '/', 'controller':

    'MainCtrl', 'template': 'main.html', 'section': 'main' }, 'detail_de_panne': { 'route': '/de-panne', 'controller': 'DetailCtrl', 'template': 'detail.html', 'section': 'de-panne', 'config': true } ... }); var resolve = { 'video': ['$rootScope', 'videoService', 'preloaderService', $rootScope.playingAnimation = true; return preloaderService.finished().then(function() { return videoService.play(routeConfig.section).then(function() { $rootScope.playingAnimation = false; }); }); }] }; function($rootScope, videoService, preloaderService) {
  4. Dev environment var _ = require('lodash'), _s = require('underscore.string'), path

    = require('path'), pushState = require('grunt-connect-pushstate/lib/utils').pushState, mountFolder = function(connect, dir) { return connect.static(path.resolve(dir)); }; module.exports = function (grunt) { ... connect: { options: { port: 9000, hostname: '0.0.0.0', livereload: 35729 }, livereload: { options: { open: true, middleware: function(connect, options, middlewares) { middlewares PLGGOHZDUHV__Ǭ>@ middlewares.push(pushState()); middlewares.push(mountFolder(connect, '.tmp')); middlewares.push(mountFolder(connect, config.yeoman.app)); return middlewares; }
  5. Prod environment (apache2) <IfModule mod_rewrite.c> RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME}

    !-d RewriteCond %{REQUEST_URI} !index RewriteCond %{REQUEST_URI} !.*\.(css|js|html|png|svg|jpg|eot|ttf|woff|json) RewriteRule (.*) index.html [L] </IfModule>
  6. Prod environment (Silex) Webserver in PHP - Inject some custom

    html in our index.html - Could also be done with Node.js
  7. Content revisioning • grunt-filerev - keeps a mapping between filename

    and revved filename • custom grunt task - injects mapping in angular app • $http interceptor - checks mapping and rewrites url to revved url if necessary • custom ngSrc directive - also checks mapping
  8. Q&A