Terminology

<object> | json Convert the object to a JSON string.

angular.element() Wraps a raw DOM element or HTML string as a jQuery element.

angular.module(<name>,<array>) Create an AngularJS module.

$compile Angular service that compiles an HTML string or DOM into a template and produces a template function, which can then be used to link scope and the template together.

Directive A mechanism by which one can create custom HTML syntax.

<form … novalidate> Disable the HTML5 form validation that is built into the browser.

<form|element>.$pristine Is the form or element in its original state.

<form>.$invalid Variable that indicates whether form <form> is invalid.

$http A core Angular service that facilitates communication with the remote HTTP servers via the browser's XMLHttpRequest object or via JSONP.

$index The zero-based index of the current array item. In Knockout, this is an observable.

$location Service. Parses the URL in the browser address bar (based on the window.location) and makes the URL available to the application. Changes to the URL in the address bar are reflected into $location service and changes to $location are reflected into the browser address bar.

Module (Angular) A container for the different parts of your AngularJS application.

<module>.directive(<name>,<function>) Create a directive inside an Angular module.

ng-cloak A CSS class that hides an element while Angular is loading.

ng-disabled=<expression> Disable a form element conditionally.

ng-model Attribute of an input element that binds the element to a model.

ng-repeat Attribute of an element that makes the element a repetition container.

ng-style Angular attribute that sets the CSS style on an HTML element conditionally via a CSS object (not a string).

$resource A factory which creates a resource object that lets you interact with RESTful server-side data sources.

Scope (Angular) An object that refers to the Angular application model. Scopes provide APIs to observe model mutations and to propagate model changes through the system into the view.

Service (Angular) A substitutable object intended for organizing code and sharing code with dependency injection.

Template (Angular) HTML that contains Angular-specific elements and attributes.

Facts, Thoughts and Opinions

Benefits of AngularJS

Adapted from text on the Angular.js homepage.

Data Binding - Data-binding provides automatic updating of the view whenever the model changes and vice-versa. The developer does not have to worry about DOM manipulation.

Controller - Angular lets you express DOM behavior in a clean readable form without the usual boilerplate of updating the DOM, registering callbacks or watching model changes.

Plain JavaScript - Unlike other frameworks, there is no need to inherit from proprietary types in order to wrap the model in accessors methods. Angular models are ordinary JavaScript objects. This makes your code easy to test, maintain, reuse, and again free from boilerplate.

Deep Linking - Angular facilitates deep linking and combines the benefits of deep linking with desktop app-like behavior.

Form Validation - Angular lets you declare the validation rules of the form without having to write JavaScript code.

Server Communication - Angular provides built-in services on top of XHR as well as various other backends using third party libraries. Promises further simplify your code by handling asynchronous return of data. In this example, we use the AngularFire library to wire up a Firebase backend to a simple Angular app.

Reusable Components - Directives let you invent new HTML syntax, specific to your application. Through directives, the user can create reusable components to hide complex DOM structure, CSS, and behavior.

Localization - Angular's locale-aware filters and stemming directives give you building blocks to make your application available in all locales.

Embedability - Angular works great with other technologies. Add as much or as little of Angular to an existing page as you like. Many other frameworks require full commitment. This page has multiple Angular applications embedded in it. Because Angular has no global state multiple apps can run on a single page without the use of iframes. We encourage you to view-source and look around.

Injectability - The dependency injection in Angular allows you to describe how your application is wired in a declarative manner. This means that your application needs no main() method which is usually an unmaintainable mess. Dependency injection is also a core to Angular. This means that any component which does not fit your needs can easily be replaced.

Testability - Angular was designed from ground up to be testable. It encourages behavior-view separation, comes pre-bundled with mocks, and takes full advantage of dependency injection. It also comes with end-to-end scenario runner which eliminates test flakiness by understanding the inner workings of Angular.

MVC Pattern Overview

The MVC pattern separates the modeling of the application domain, the presentation, and the actions based on user input into three separate classes:

  • The model manages the behavior and data of the application domain, responds to requests for information about its state (usually from the view), and responds to instructions to change state (usually from the controller).
  • The view manages the presentation of data to the user and transmits user input to the controller.
  • The controller interprets the user input transmitted to it, informing the model and/or the view to change as appropriate.

In a traditional client-side application, the pattern is quite straightforward. The user interacts directly with the view, and the view communicates with the controller. The controller processes requests from the view, makes requests of the model, and returns data from the model to the view. On the Web, however, the pattern is not quite as straightforward. The view outputs HTML, CSS and JavaScript to provide the interface that the user actually utilizes.

In recent years, web developers have learned that there are really two entirely separate MVC "stacks" in play: one on the server, one on the client. Modern JavaScript frameworks such as AngularJS and Backbone have emerged to support this paradigm to varying degrees.

The server-side stack uses an application framework such as Zend.

Server Client
Controller Model View Controller Model View
Zend controller Doctrine model Zend .phtml Backbone view controller Backbone collection HTML, CSS, JavaScript

Images

[[/div]]