AngularJS

From Wikipedia, the free encyclopedia - View original article

AngularJS
AngularJS logo
Developer(s)Brat Tech LLC, Google and community.
Initial release2009 (2009)
Stable release1.3.3 / November 17, 2014; 4 days ago (2014-11-17)
Development statusActive
Written inJavaScript
PlatformCross-platform, see Legacy browser support
Size121 KiB production
915 KiB development
TypeJavaScript library
LicenseMIT License
Websiteangularjs.org
 
Jump to: navigation, search
AngularJS
AngularJS logo
Developer(s)Brat Tech LLC, Google and community.
Initial release2009 (2009)
Stable release1.3.3 / November 17, 2014; 4 days ago (2014-11-17)
Development statusActive
Written inJavaScript
PlatformCross-platform, see Legacy browser support
Size121 KiB production
915 KiB development
TypeJavaScript library
LicenseMIT License
Websiteangularjs.org

AngularJS, commonly referred to as Angular, is an open-source web application framework maintained by Google and a community of individual developers and corporations to address many of the challenges encountered in developing single-page applications. Its goal is to simplify both development and testing of such applications by providing a framework for client-side model–view–controller (MVC) architecture, along with components commonly used in rich internet applications.

The library works by first reading the HTML page, which has embedded into it additional custom tag attributes. Those attributes are interpreted as directives telling Angular to bind input or output parts of the page to a model that is represented by standard JavaScript variables. The values of those JavaScript variables can be manually set within the code, or retrieved from static or dynamic JSON resources.

Philosophy[edit]

AngularJS is built around the belief that declarative programming should be used for building user interfaces and connecting software components, while imperative programming is better suited to defining an application's business logic.[1] The framework adapts and extends traditional HTML to present dynamic content through two-way data-binding that allows for the automatic synchronization of models and views. As a result, AngularJS de-emphasizes DOM manipulation with the goal of improving testability and performance.

AngularJS's design goals include:

Angular implements the MVC pattern to separate presentation, data, and logic components. Using dependency injection, Angular brings traditionally server-side services, such as view-dependent controllers, to client-side web applications. Consequently, much of the burden on the server can be reduced.

Bootstrapper[edit]

The tasks performed by the AngularJS bootstrapper occur in three phases[2] after the DOM has been loaded:

  1. Creation of a new Injector
  2. Compilation of the directives that decorate the DOM
  3. Linking of all directives to scope

Notable directives[edit]

AngularJS directives allow the developer to specify custom and reusable HTML-like elements and attributes that define data bindings and the behavior of presentation components. Some of the most commonly used directives are:

ng-app
Declares the root element of an AngularJS application, under which directives can be used to declare bindings and define behavior.
ng-bind
Sets the text of a DOM element to the value of an expression. For example, <span ng-bind="name"></span> will display the value of ‘name’ inside the span element. Any changes to the variable ‘name’ in the application's scope are reflected instantly in the DOM.
ng-model
Similar to ng-bind, but establishes a two-way data binding between the view and the scope.
ng-model-options
Allows tuning how model updates are done.
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. Show and hide is achieved by setting the CSS display style.
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. When the condition is false, the element is removed from the DOM. When true, a clone of the compiled element is re-inserted

Two-way data binding[edit]

AngularJS' two-way data binding is its most notable feature, and it reduces the amount of code written by relieving the server backend of 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] AngularJS detects changes in models by comparing the values with stored earlier values in a process of dirty-checking, unlike Ember.js and Backbone.js which trigger listeners when the model values are changed.[4]

Chrome plugin[edit]

In July 2012, the Angular team built a plugin for the Google Chrome browser called Batarang,[5] that improves the debugging experience for web applications built with Angular. The extension aims to allow for easy detection of performance bottlenecks and offers a GUI for debugging applications.[6] The extension is not compatible with recent releases (after v1.2.x) of Angular.[7]

Legacy browser support[edit]

Versions 1.2 and later of AngularJS do not support Internet Explorer versions 6 or 7.[8] Versions 1.3 and later of AngularJS dropped support for Internet Explorer 8.[9]

Development history[edit]

AngularJS was originally developed in 2009 by Miško Hevery and Adam Abrons [10] at Brat Tech LLC[11] 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",[11] and had a few subscribers, before the two decided to abandon the business idea and release Angular as an open-source library.[citation needed]

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.[12]

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).[13]

The code names are super-power related, composed of two hyphen-joined words, should sound “fun / crazy / cool”, and are publicly submitted and voted by users.[14]

AngularJS versions
Release DatesVersionCodename
Nov 20, 20141.2.27prime-factorization (stable)
Nov 17, 20141.3.3undersea-arithmetic (stable)
Nov 7, 20141.3.2cardiovasculatory-magnification (stable)
Oct 31, 20141.3.1spectral-lobster (stable)
Oct 13, 20141.3.0superluminal-nudge (stable)
Oct 8, 20141.3.0-rc.5impossible-choreography (unstable)
Oct 1, 20141.3.0-rc.4unicorn-hydrafication (unstable)
Oct 1, 20141.2.26captivating-disinterest (stable)
Sep 23, 20141.3.0-rc.3aggressive-pacification (unstable)
Sep 16, 20141.3.0-rc.2tactile-perception (unstable)
Sep 16, 20141.2.25hypnotic-gesticulation (stable)
Sep 9, 20141.3.0-rc.1backyard-atomicity (unstable)
Sep 9, 20141.2.24static-levitation (stable)
Aug 29, 20141.3.0-rc.0sonic-boltification (unstable)
Aug 22, 20141.2.23superficial-malady (stable)
Aug 22, 20141.3.0-beta.19rafter-ascension (unstable)
Aug 12, 20141.2.22finicky-pleasure (stable)
Aug 12, 20141.3.0-beta.18spontaneous-combustion (unstable)
Jul 25, 20141.2.21wizard-props (stable)
Jul 25, 20141.3.0-beta.17turing-autocompletion (unstable)
Jul 18, 20141.3.0-beta.16pizza-transubstantiation (unstable)
Jul 11, 20141.3.0-beta.15unbelievable-advancement (unstable)
Jul 11, 20141.2.20accidental-beautification (stable)
Jul 1, 20141.3.0-beta.14harmonious-cacophonies (unstable)
Jul 1, 20141.2.19precognitive-flashbacks (stable)
Jun 16, 20141.3.0-beta.13idiosyncratic-numerification (unstable)
Jun 13, 20141.3.0-beta.12ephemeral-acceleration (unstable)
Jun 13, 20141.2.18ear-extendability (stable)
Jun 6, 20141.3.0-beta.11transclusion-deforestation (unstable)
Jun 6, 20141.2.17quantum disentanglement (stable)
May 23, 20141.3.0-beta.10excessive-clarification (unstable)
May 16, 20141.3.0-beta.9release-naming (unstable)
May 09, 20141.3.0-beta.8accidental-haiku (unstable)
Apr 25, 20141.3.0-beta.7proper-attribution (unstable)
Apr 21, 20141.3.0-beta.6expedient-caffeination (unstable)
Apr 3, 20141.3.0-beta.5chimeric-glitterfication (unstable)
Apr 3, 20141.2.16badger-enumeration (stable)
Mar 28, 20141.3.0-beta.4inconspicuous-deception (unstable)
Mar 21, 20141.2.15beer-underestimating (stable)
Mar 21, 20141.3.0-beta.3emotional-waffles (unstable)
Mar 14, 20141.3.0-beta.2silent-ventriloquism (unstable)
Mar 8, 20141.3.0-beta.1retractable-eyebrow (unstable)
Mar 1, 20141.2.14feisty-cryokinesis (stable)
Feb 14, 20141.2.13romantic-transclusion (stable)
Feb 7, 20141.2.12cauliflower-eradication (stable)
Feb 3, 20141.2.11cryptocurrency-hyperdeflation (stable)
Jan 24, 20141.2.10augmented-serendipity (stable)
Jan 15, 20141.2.9enchanted-articulacy (stable)
Jan 10, 20141.2.8interdimensional-cartography (stable)
Jan 3, 20141.2.7emoji-clairvoyance (stable)
Dec 19, 20131.2.6taco-salsafication (stable)
Dec 13, 20131.2.5singularity-expansion (stable)
Dec 6, 20131.2.4wormhole-blaster (stable)
Nov 27, 20131.2.3unicorn-zapper (stable)
Nov 22, 20131.2.2consciousness-inertia (stable)
Nov 14, 20131.2.1underscore-empathy (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)[13]
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.[15]
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 provides a $http service which is more flexible, connecting to remote servers either through a browser's XMLHttpRequest object or via JSONP.[16]
Templating
AngularJS templating uses a combination of customizable HTML tags and expressions. Backbone.js ships with underscore.js's utility function template() and also integrates with different templating engines such as Mustache.[15]

See also[edit]

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. ^ Misko Hevery. "Databinding in angularjs". Retrieved 2014-03-09. 
  5. ^ "angular/angularjs-batarang (GitHub)". Retrieved 2014-10-12. 
  6. ^ Ford, Brian. "Introducing the AngularJS Batarang". AngularJS Blog. Retrieved 2014-10-12. 
  7. ^ "batarang Chrome extension for AngularJS appears broken". 
  8. ^ "AngularJS: Developer Guide: Internet Explorer Compatibility". Google. Retrieved 2014-10-12. 
  9. ^ Minar, Igor. "AngularJS 1.3: a new release approache". AngularJS Blog. Retrieved 2014-10-12. 
  10. ^ "Hello World, <angular/> is here". Retrieved 2014-10-12. 
  11. ^ a b "GetAngular". Angular / BRAT Tech. LLC. Retrieved 2014-10-12. 
  12. ^ "Contributors to angular/angular.js (GitHub)". Retrieved 2014-10-12. 
  13. ^ a b "AngularJS 1.0 -> 1.2 Roadmap". blog.angularjs.org. July 26, 2012. Retrieved 2013-04-27. 
  14. ^ "AngularJS Code Names - Google Moderator". Google. Retrieved 2014-10-12. 
  15. ^ a b "Backbonejs vs Angularjs: Demystifying the myths". Retrieved 13 February 2013. 
  16. ^ "Javascript Frameworks And Data Binding". Retrieved 13 February 2013. 

Further reading[edit]

External links[edit]