Essentially Angular

Essentially Angular

@kevin_noonan

Python Ireland

8th Jan 2014, Dublin

Hit 'M' for overview of slides. Press 'M' again to exit.

Simple Angular app

ng-app bootstraps your Angular app

Origins of AngularJS

High-Level Overview of AngularJS

Angular is an MVC Framework

Jargon: data-binding

A Potted History of Native Web Development

  • Brief (and woefully incomplete).
  • Web Development approach 1

  • HTML templates with tags.
  • Server inserts data (often from a database).
  • Example: Django templates.
  • Document Object Model ("DOM")

    Web Development approach 2

    Web Development approach 3

  • Rich client in the browser
  • ...built with Ember or Angular
    ...consuming a REST API on the server.

    Single Greatest Tool for AngularJS Development

  • AngularJS Batarang
  • Add-on for Chrome Developer Tools.
  • With Batarang, you can examine the model of the app.
  • Google Trends

    Angular versus jQuery

    Angular Learning Curve

    Angular Phonecat

    A view from Angular Phonecat

    Source: github.com/angular/angular-phonecat/blob/step-2/app/index.html

    Scope is crucial to Angular

    A controller from Angular Phonecat

    Source: github.com/angular/angular-phonecat/blob/step-2/app/js/controllers.js

    Angular loves JSON

    Filters

    Phonecat View with a Filter

    Source: github.com/angular/angular-phonecat/blob/step-3/app/index.html

    Angular-grunt-coffeescript

    Polyglot Angular

    (* Source: Adam Bard, 30th Aug 2013.)

    What you need to know about CoffeeScript

    Sample Coffee object

    Equivalent JavaScript

    Node is needed for its toolchain

    Convert CoffeeScript snippets to JavaScript

    Let's talk about DI

    angular.module

    The app's modules

    Source: github.com/roytruelove/angular-grunt-coffeescript/blob/develop/src/main/app/app.coffee

    Routes to the app's pages

    Source: github.com/roytruelove/angular-grunt-coffeescript/blob/develop/src/main/app/app.coffee

    Configuring the routes

    How Angular works

    The run method

    The run block

    Source: github.com/roytruelove/angular-grunt-coffeescript/blob/develop/src/main/app/app.coffee

    The Power of Directives

    A simple directive, built with jQuery

    • Note: headlessCamelCase for directive name.
    Source: github.com/roytruelove/angular-grunt-coffeescript/blob/develop/src/main/app/common/directives/glowGreenOnMouseoverDirective.coffee

    The directive in a view

    Source: github.com/roytruelove/angular-grunt-coffeescript/blob/develop/src/main/app/searchView/searchView.html

    Services for Code Organisation

    A service to retrieve the data for the app

    Source: https://github.com/roytruelove/angular-grunt-coffeescript/blob/develop/src/main/app/common/services/dataSvc.coffee

    Using the service in a controller

    Source: https://github.com/roytruelove/angular-grunt-coffeescript/blob/develop/src/main/app/searchView/searchViewCtrl.coffee

    Online resources

    Python on the server

    Beyond CoffeeScript

    Add-on packages

    Embrace the JavaScript ecosystem

    "God is in the structure"

    Learn about Chrome Developer Tools

    Number One Tip for AngularJS development

  • The Chrome add-on: AngularJS Batarang
  • Where to go from here

    Credits

    Questions

    @kevin_noonan

    /