Ajmal Afif's blog

Balancing between consuming knowledge and creating values.

AngularJS workshop by Matt from RedApe Solutions

Some introduction by attendees.

A walkthrough on a chat app. Github repo here: https://github.com/matiboy/AngularBasicsChat

Modules

  • Your app
  • Adding dependencies
    • Script tag
    • Inject

Routes

$ git checkout BasicRouting

  • URLs to views
  • Parameters
    • .when
    • .otherwise
  • Options
    • Template/templateUrl
    • Controller
    • resolve (added in 1.1.5 Angular)

Services

  • Angular services are singletons objects or functions that carry out specific taks common to web apps. Handle business logics.
    • Singleton
    • Lazily executed
    • Available app-wide via dependency injection
  • Types of services
    • Value
    • Service / Factory | it’s a function that …. | can do caching etc
  • Built-in service
    • handles AJAX …
    • Start with $
    • $http, $resource, $q, $swipe etc
  • Build service whenever you
    • Want to execute the same taks from several places in the app
    • Want to keep app states
    • Need to communicate with external API

Controllers

  • Two way data binding
  • $scope is the glue
  • controller as syntax

Comments