Jump to content

AngularJS

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Mysekurity (talk | contribs) at 04:48, 26 March 2013 (→‎Comparisons to Backbone.js: de-duplicate a reference). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

AngularJS
Developer(s)Google Inc. and community.
Initial release2009 (2009)
Stable release
1.0.4 / January 22, 2013; 11 years ago (2013-01-22)
Repository
Written inJavaScript
Operating systemCross-platform
Size77KB production
472KB development
TypeJavaScript framework
LicenseMIT License
Websitewww.angularjs.org

AngularJS is an open-source JavaScript framework, maintained by Google, that assists with running what are known as 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

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:

  • Decouple DOM manipulation from app logic. This improves the testability of the code.
  • Regard app testing as equal in importance to app writing. Testing difficulty is dramatically affected by the way the code is structured.
  • Decouple the client side of an app from the server side. This allows development work to progress in parallel, and allows for reuse of both sides.
  • Guide developers through the entire journey of building an app: from designing the UI, through writing the business logic, to testing.
  • Make common tasks trivial and difficult tasks possible.

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.

Notable Angular directives

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 an 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.

Two-way data binding

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

Chrome plugin

In July 2012, the Angular team built a plugin for the Google Chrome browser called Batarang,[3] 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.[4]

Development history

AngularJS 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 some signed-up users, 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

AngularJS versions
Release Date Version Codename
Jan 22, 2013 1.1.2 tofu-animation
Jan 22, 2013 1.0.4 bewildering-hair
Nov 26, 2012 1.1.1 pathological-kerning
Nov 26, 2012 1.0.3 bouncy-thunder
Aug 31, 2012 1.1.0 increase-gravatas
Aug 31, 2012 1.0.2 debilitating-awesomeness
Jun 25, 2012 1.0.1 thorium-shielding
Jun 13, 2012 1.0.0 temporal-domination
Jun 12, 2012 1.0.0rc12 regression-extermination
Jun 10, 2012 1.0.0rc11 promise-resolution
May 23, 2012 1.0.0rc10 tesseract-giftwrapping
May 14, 2012 1.0.0rc9 eggplant-teleportation
May 6, 2012 1.0.0rc8 blooming-touch
Apr 30, 2012 1.0.0rc7 rc-generation
Apr 20, 2012 1.0.0rc6 runny-nose
Apr 12, 2012 1.0.0rc5 reality-distortion
Apr 5, 2012 1.0.0rc4 insomnia-induction
Mar 29, 2012 1.0.0rc3 barefoot-telepathy
Mar 20, 2012 1.0.0rc2 silence-absorption
Mar 13, 2012 1.0.0rc1 moiré-vision
Jan 17, 2012 0.10.6 bubblewrap-cape
Nov 8, 2011 0.10.5 steel-fist
Oct 22, 2011 0.10.4 human-torch
Oct 13, 2011 0.10.3 shattering-heartbeat
Oct 8, 2011 0.10.2 sneaky-seagull
Sep 9, 2011 0.10.1 inexorable-juggernaut
Sep 2, 2011 0.10.0 chicken-hands
Aug 20, 2011 0.9.19 canine-psychokinesis
Jul 29, 2011 0.9.18 jiggling-armfat
Jun 30, 2011 0.9.17 vegetable-reanimation
Jun 7, 2011 0.9.16 weather-control
April 11, 2011 0.9.15 lethal-stutter
April 1, 2011 0.9.14 key-maker
Mar 13, 2011 0.9.13 curdling-stare
Mar 3, 2011 0.9.12 thought-implanter
Feb 8, 2011 0.9.11 snow-maker
Jan 26, 2011 0.9.10 flea-whisperer
Jan 13, 2011 0.9.9 time-shift
Dec 23, 2010 0.9.8 astral-projection
Dec 10, 2010 0.9.7 sonic-scream
Dec 6, 2010 0.9.6 night-vision
Nov 25, 2010 0.9.5 turkey-blast
Nov 18, 2010 0.9.4 total-recall
Nov 10, 2010 0.9.3 cold-resistance
Nov 3, 2010 0.9.2 faunal-mimicry
Oct 26, 2010 0.9.1 repulsion-field
Oct 20, 2010 0.9.0 dragon-breath

Comparisons to Backbone.js

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.[5]
REST
Backbone.js communicates well with RESTful backends, while AngularJS' $http service is more flexible, connecting to remote servers either through a browser's XMLHttpRequest object or via JSONP.[6]
Templating
To handle views, AngularJS uses customizable HTML tags. Backbone.js, on the other hand, requires a templating engine, such as Underscore.js.[5]

See also

References

  1. ^ "What Is Angular?". Retrieved 12 February 2013. {{cite web}}: Unknown parameter |deadurl= ignored (|url-status= suggested) (help)
  2. ^ "5 Awesome AngularJS Features". Retrieved 13 February 2013. {{cite web}}: Unknown parameter |deadurl= ignored (|url-status= suggested) (help)
  3. ^ Batarang homepage
  4. ^ http://blog.angularjs.org/2012/07/introducing-angularjs-batarang.html
  5. ^ a b "Backbonejs vs Angularjs: Demystifying the myths". Retrieved 13 February 2013.
  6. ^ "Javascript Frameworks And Data Binding". Retrieved 13 February 2013.

Further reading

External links