AngularJS

From Wikipedia, the free encyclopedia - View original article

AngularJS
AngularJS logo
Developer(s)Google Inc. and community.
Initial release2009 (2009)
Stable release1.2.6 / December 19, 2013; 15 days ago (2013-12-19)
Development statusActive
Written inJavaScript
Operating systemCross-platform
Size97 KiB production
693 KiB development
TypeJavaScript framework
LicenseMIT License
Websitewww.angularjs.org
 
Jump to: navigation, search
AngularJS
AngularJS logo
Developer(s)Google Inc. and community.
Initial release2009 (2009)
Stable release1.2.6 / December 19, 2013; 15 days ago (2013-12-19)
Development statusActive
Written inJavaScript
Operating systemCross-platform
Size97 KiB production
693 KiB development
TypeJavaScript framework
LicenseMIT License
Websitewww.angularjs.org

AngularJS is an open-source JavaScript framework, maintained by Google, that assists with running single-page applications. Its goal is to augment browser-based applications with model–view–controller (MVC) capability, in an effort to make both development and testing easier.

The library reads in HTML that contains additional custom tag attributes; it then obeys the directives in those custom attributes, and binds input or output parts of the page to a model represented by standard JavaScript variables. The values of those JavaScript variables can be manually set, or retrieved from static or dynamic JSON resources.

The philosophy of Angular[edit]

AngularJS is built around the belief that declarative programming should be used for building UIs and wiring software components, while imperative programming is excellent for expressing business logic.[1] The framework adapts and extends traditional HTML to better serve dynamic content through two-way data-binding that allows for the automatic synchronization of models and views. As a result, AngularJS deemphasizes DOM manipulation and improves testability.

Design goals:

Angular follows the MVC pattern of software engineering and encourages loose coupling between presentation, data, and logic components. Using dependency injection, Angular brings traditional server-side services, such as view-dependent controllers, to client-side web applications. Consequently, much of the burden on the backend is reduced, leading to much lighter web applications.

The AngularJS Boot Strapper[edit]

There are three phases of the AngularJS boot strapper[2] that occur after the DOM completes loading:

  1. Create a new Injector
  2. Compile service - The Compile service is like compiling in C or C++. It walks the DOM and locates all the directives such as "ng-app".
  3. Link phase - The link phase attaches all the directives to scope.

Notable Angular directives[edit]

AngularJS directives allow the developer to specify custom and reusable HTML tags that moderate the behavior of certain elements.

ng-app
Declares an element as a root element of the application allowing behavior to be modified through custom HTML tags.
ng-bind
Automatically changes the text of a HTML element to the value of a given expression.
ng-model
Similar to ng-bind, but allows two-way data binding between the view and the scope.
ng-class
Allows class attributes to be dynamically loaded.
ng-controller
Specifies a JavaScript controller class that evaluates HTML expressions.
ng-repeat
Instantiate an element once per item from a collection.
ng-show & ng-hide
Conditionally show or hide an element, depending on the value of a boolean expression.
ng-switch
Conditionally instantiate one template from a set of choices, depending on the value of a selection expression.
ng-view
The base directive responsible for handling routes that resolve JSON before rendering templates driven by specified controllers.
ng-if
Basic if statement directive which allow to show the following element if the conditions are true.

Two-way data binding[edit]

AngularJS' two-way data binding is its most notable feature and reduces the amount of code written by relieving the server backend from templating responsibilities. Instead, templates are rendered in plain HTML according to data contained in a scope defined in the model. The $scope service in Angular detects changes to the model section and modifies HTML expressions in the view via a controller. Likewise, any alterations to the view are reflected in the model. This circumvents the need to actively manipulate the DOM and encourages bootstrapping and rapid prototyping of web applications.[3] Some commentators say the AngularJS approach to data binding is much more straightforward than using either Ember.js[4] or Backbone.js.[5]

Chrome plugin[edit]

In July 2012, the Angular team built a plugin for the Google Chrome browser called Batarang,[6] that improves the debugging experience for web applications built with Angular. The extension allows for easy detection of performance bottlenecks and offers a GUI for debugging applications.[7]

Legacy browser support[edit]

Versions 1.2 and later of AngularJS do not support IE7 or IE6 [1]. Versions 1.3 and later of AngularJS drop support for Internet Explorer 8 [2].

Development history[edit]

VVerga was originally developed in 2009 by Miško Hevery and Adam Abrons as the software behind an online JSON storage service, that would have been priced by the megabyte, for easy-to-make applications for the enterprise. This venture was located at the web domain "GetAngular.com", and had a few subscribers, before the two decided to abandon the business idea and release Angular as an open-source library.

Abrons left the project, but Hevery, who works at Google, continues to develop and maintain the library with fellow Google employees Igor Minár and Vojta Jína.

Releases[edit]

Releases 1.0.x and 1.2.x are the stable versions, whereas 1.1.x contained breaking changes between minor releases (i.e. 1.1.x – 1.1.y).[8]

AngularJS versions
Release DateVersionCodename
Dec 19, 20131.2.6taco-salsafication (stable)
Dec 13, 20131.2.5singularity-expansion (stable)
Dec 6, 20131.2.4wormhole-blaster (stable)
Nov 14, 20131.2.1unicorn-zapper (stable)
Nov 8, 20131.2.0timely-delivery (stable)
Oct 15, 20131.2.0rc3ferocious-twitch (unstable)
Sep 4, 20131.2.0rc2barehand-atomsplitting (unstable)
Aug 22, 20131.0.8bubble-burst (stable)
Aug 13, 20131.2.0rc1spooky-giraffe (unstable)
May 22, 20131.0.7monochromatic-rainbow (stable)
May 22, 20131.1.5triangle-squarification (unstable)
Apr 4, 20131.0.6universal-irreversibility (stable)
Apr 3, 20131.1.4quantum-manipulation (unstable)
Feb 22, 20131.1.3radioactive-gargle
Feb 20, 20131.0.5flatulent-propulsion
Jan 22, 20131.1.2tofu-animation
Jan 22, 20131.0.4bewildering-hair
Nov 26, 20121.1.1pathological-kerning
Nov 26, 20121.0.3bouncy-thunder
Aug 31, 20121.1.0increase-gravatas
Aug 31, 20121.0.2debilitating-awesomeness
Jun 25, 20121.0.1thorium-shielding
Jun 13, 20121.0.0temporal-domination (stable)[8]
Jun 12, 20121.0.0rc12regression-extermination
Jun 10, 20121.0.0rc11promise-resolution
May 23, 20121.0.0rc10tesseract-giftwrapping
May 14, 20121.0.0rc9eggplant-teleportation
May 6, 20121.0.0rc8blooming-touch
Apr 30, 20121.0.0rc7rc-generation
Apr 20, 20121.0.0rc6runny-nose
Apr 12, 20121.0.0rc5reality-distortion
Apr 5, 20121.0.0rc4insomnia-induction
Mar 29, 20121.0.0rc3barefoot-telepathy
Mar 20, 20121.0.0rc2silence-absorption
Mar 13, 20121.0.0rc1moiré-vision
Jan 17, 20120.10.6bubblewrap-cape
Nov 8, 20110.10.5steel-fist
Oct 22, 20110.10.4human-torch
Oct 13, 20110.10.3shattering-heartbeat
Oct 8, 20110.10.2sneaky-seagull
Sep 9, 20110.10.1inexorable-juggernaut
Sep 2, 20110.10.0chicken-hands
Aug 20, 20110.9.19canine-psychokinesis
Jul 29, 20110.9.18jiggling-armfat
Jun 30, 20110.9.17vegetable-reanimation
Jun 7, 20110.9.16weather-control
April 11, 20110.9.15lethal-stutter
April 1, 20110.9.14key-maker
Mar 13, 20110.9.13curdling-stare
Mar 3, 20110.9.12thought-implanter
Feb 8, 20110.9.11snow-maker
Jan 26, 20110.9.10flea-whisperer
Jan 13, 20110.9.9time-shift
Dec 23, 20100.9.8astral-projection
Dec 10, 20100.9.7sonic-scream
Dec 6, 20100.9.6night-vision
Nov 25, 20100.9.5turkey-blast
Nov 18, 20100.9.4total-recall
Nov 10, 20100.9.3cold-resistance
Nov 3, 20100.9.2faunal-mimicry
Oct 26, 20100.9.1repulsion-field
Oct 20, 20100.9.0dragon-breath

Comparisons to Backbone.js[edit]

Data-binding
The most prominent feature that separates the two libraries is in the way models and views are synchronized. Whereas AngularJS supports two way data-binding, Backbone.js relies heavily on boilerplate code to harmonize its models and views.[9]
REST
Backbone.js communicates well with RESTful backends. A very simple use of REST APIs is also available with AngularJS using the $resource service. AngularJS also provide a $http service which is more flexible, connecting to remote servers either through a browser's XMLHttpRequest object or via JSONP.[10]
Templating
AngularJS templating uses a combination of customizable HTML tags and expressions. Backbone.js uses different templating engines such as Mustache.[9]

References[edit]

  1. ^ "What Is Angular?". Retrieved 12 February 2013. 
  2. ^ "Writing Directives". angularjs.org. November 28, 2012. Retrieved 2013-07-21. 
  3. ^ "5 Awesome AngularJS Features". Retrieved 13 February 2013. 
  4. ^ Cédric Beust (December 29, 2012). "Migrating from Ember.js to AngularJS". Retrieved 2013-06-01. 
  5. ^ Joel Rosen (April 9, 2013). "Using AngularJS at Localytics". Localytics. Retrieved 2013-06-01. 
  6. ^ Batarang homepage
  7. ^ http://blog.angularjs.org/2012/07/introducing-angularjs-batarang.html
  8. ^ a b "AngularJS 1.0 -> 1.2 Roadmap". blog.angularjs.org. July 26, 2012. Retrieved 2013-04-27. 
  9. ^ a b "Backbonejs vs Angularjs: Demystifying the myths". Retrieved 13 February 2013. 
  10. ^ "Javascript Frameworks And Data Binding". Retrieved 13 February 2013. 

Further reading[edit]

External links[edit]