DTVE 1.5
Hunter Loftis
hunter@skookum.com

Differentiators


  1. Two-way data binding
  2. Dependency injection
  3. Extending HTML vocabulary

Two-Way Data Binding

Similar to Knockout.js:

  • Keeps things DRY
  • Single source of truth
  • Multiple views connected to the same model
  • Alternate views (mobile, desktop) on single model

<input ng-model='user.name'>

$scope.user = { name: 'Hunter' };

Dependency Injection

Helps in several scenarios:

  • Memory management
  • Automated testing
  • Code reuse
  • Decoupled architecture

function Controller($scope, $http, $compile) ...

Extending HTML

"Directives" are possibly the most compelling part of Angular.

New elements:

<dtv-carousel>
<dtv-filterlist>

New attributes:

<span ng-pluralize>

When to use Angular

  • Modularity and reuseable components is a goal
  • Testing and maintainability is a priority
  • Building a single-page application (SPA)
  • Following an AJAX + API architecture
  • Implementing non-trivial interactivity
  • Designing a fluid, dynamic, app-like user experience

When not to use Angular

  • Building a series of simple, traditional pages
  • Designing for minimal interactivity
  • Implementing with limited JavaScript resources
  • Client-side rendering is unacceptable

angularjs-basics

By hunterloftis

angularjs-basics

  • 1,262