Not logged in - Login

AngularJS: Get Started

Pluralsight (Subscription Required)
Tutorial Summary: "...demonstrates how to use the essential abstractions of AngularJS, including modules, controllers, directives, and services."

Getting Started

  1. Add a script tag pointing to angular.js.min
  2. Add an ng-app attribute in your html
    • ng-app is an angular directive
    • ng is short for angular
    • The ng-app directive can only be used once per page and lets Angular know what area of the page to watch
  3. Add a binding expression by using two left brackets ({)using

Javascript Patterns

  • Functions as abstractions
  • Revealing Patter Module - Functions to build modules
  • Immediately invoked function expression (IFFE) - Functions to avoid global vars

Angular Controllers

  1. Add the ng-controller directive with the name of the controller to a Html element.
    • The controller will be a function that Angular invokes
    • Controllers take a parameters, use the $scope parameter to define the model.
An app may have:
  • Multiple Controllers
  • Complex Objects
  • Nested Controllers
Http Service
  • Encapsulates http communication over GET, POST, PUT and DELETE
  • The http service must be included as a parameter in a controller