Você está na página 1de 8

AngularJS

1
AngularJS
AngularJS
Developer(s) Google Inc. and community.
Initial release 2009
Stable release 1.2.14 / March1, 2014
Development status Active
Written in JavaScript
Operating system Cross-platform
Size 100 KiB production
724 KiB development
Type JavaScript framework
License MIT License
Website
www.angularjs.org
[1]
AngularJS is an open-source JavaScript framework, maintained by Google, that assists with running single-page
applications. Its goal is to augment web-based applications with modelviewcontroller (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.
Philosophy
AngularJS is built around the belief that declarative programming should be used for building user interfaces and
wiring software components, while imperative programming is excellent for expressing business logic. 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 application logic. This improves the testability of the code.
Regard application testing as equal in importance to application writing. Testing difficulty is dramatically affected
by the way the code is structured.
Decouple the client side of an application 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 application: from designing the UI, through writing
the business logic, to testing.
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.
AngularJS
2
Bootstrapper
There are three phases of the AngularJS bootstrapper that occur after the DOM completes loading:
1. 1. Create a new Injector
2. 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. 3. Link phase - The link phase attaches all the directives to scope.
Notable 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. 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.
AngularJS
3
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. 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.
Chrome plugin
In July 2012, the Angular team built a plugin for the Google Chrome browser called Batarang,
[2]
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.
[3]
The extension is not compatible with recent
releases of Angular.
Legacy browser support
Versions 1.2 and later of AngularJS do not support Internet Explorer versions 6 or 7.
[4]
Versions 1.3 and later of
AngularJS drop support for Internet Explorer 8.
[5]
Development history
AngularJS was originally developed in 2009 by Miko 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.
[citation needed]
Abrons left the project, but Hevery, who works at Google, continues to develop and maintain the library with fellow
Google employees Igor Minr and Vojta Jna.
[citation needed]
Releases
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).
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.
AngularJS
4
AngularJS versions
Release Date Version Codename
Mar 14, 2014 1.3.0-beta.2
silent-ventriloquism
[6]
(unstable)
Mar 8, 2014 1.3.0-beta.1
retractable-eyebrow
[7]
(unstable)
Mar 1, 2014 1.2.14
feisty-cryokinesis
[8]
(stable)
Feb 14, 2014 1.2.13
romantic-transclusion
[9]
(stable)
Feb 7, 2014 1.2.12
cauliflower-eradication
[10]
(stable)
Feb 3, 2014 1.2.11
cryptocurrency-hyperdeflation
[11]
(stable)
Jan 24, 2014 1.2.10
augmented-serendipity
[12]
(stable)
Jan 15, 2014 1.2.9
enchanted-articulacy
[13]
(stable)
Jan 10, 2014 1.2.8
interdimensional-cartography
[14]
(stable)
Jan 3, 2014 1.2.7
emoji-clairvoyance
[15]
(stable)
Dec 19, 2013 1.2.6
taco-salsafication
[16]
(stable)
Dec 13, 2013 1.2.5
singularity-expansion
[17]
(stable)
Dec 6, 2013 1.2.4
wormhole-blaster
[18]
(stable)
Nov 27, 2013 1.2.3
unicorn-zapper
[19]
(stable)
Nov 22, 2013 1.2.2
consciousness-inertia
[20]
(stable)
Nov 14, 2013 1.2.1
underscore-empathy
[21]
(stable)
Nov 8, 2013 1.2.0
timely-delivery
[22]
(stable)
Oct 15, 2013 1.2.0rc3
ferocious-twitch
[23]
(unstable)
Sep 4, 2013 1.2.0rc2
barehand-atomsplitting
[24]
(unstable)
Aug 22, 2013 1.0.8
bubble-burst
[25]
(stable)
Aug 13, 2013 1.2.0rc1
spooky-giraffe
[26]
(unstable)
May 22, 2013 1.0.7
monochromatic-rainbow
[27]
(stable)
May 22, 2013 1.1.5
triangle-squarification
[28]
(unstable)
Apr 4, 2013 1.0.6
universal-irreversibility
[29]
(stable)
Apr 3, 2013 1.1.4
quantum-manipulation
[30]
(unstable)
Feb 22, 2013 1.1.3
radioactive-gargle
[31]
Feb 20, 2013 1.0.5
flatulent-propulsion
[32]
Jan 22, 2013 1.1.2
tofu-animation
[33]
Jan 22, 2013 1.0.4
bewildering-hair
[33]
Nov 26, 2012 1.1.1
pathological-kerning
[33]
AngularJS
5
Nov 26, 2012 1.0.3
bouncy-thunder
[33]
Aug 31, 2012 1.1.0
increase-gravatas
[33]
Aug 31, 2012 1.0.2
debilitating-awesomeness
[34]
Jun 25, 2012 1.0.1
thorium-shielding
[35]
Jun 13, 2012 1.0.0 temporal-domination (stable)
Jun 12, 2012 1.0.0rc12
regression-extermination
[36]
Jun 10, 2012 1.0.0rc11
promise-resolution
[37]
May 23, 2012 1.0.0rc10
tesseract-giftwrapping
[38]
May 14, 2012 1.0.0rc9
eggplant-teleportation
[39]
May 6, 2012 1.0.0rc8
blooming-touch
[40]
Apr 30, 2012 1.0.0rc7
rc-generation
[41]
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
AngularJS
6
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.
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.
Templating
AngularJS templating uses a combination of customizable HTML tags and expressions. Backbone.js uses
different templating engines such as Mustache.
References
[1] http:/ / www. angularjs.org/
[2] Batarang homepage (https:/ / github.com/ angular/ angularjs-batarang)
[3] http:/ / blog. angularjs.org/ 2012/ 07/ introducing-angularjs-batarang. html
[4] http:/ / docs.angularjs. org/ guide/ ie
[5] http:/ / blog. angularjs.org/ 2013/ 12/ angularjs-13-new-release-approaches. html
[6] https:/ / github.com/ angular/ angular. js/ blob/ master/ CHANGELOG. md#1. 3. 0-beta. 2
[7] https:/ / github.com/ angular/ angular. js/ blob/ master/ CHANGELOG. md#1. 3. 0-beta. 1
[8] https:/ / github.com/ angular/ angular. js/ blob/ master/ CHANGELOG. md#1. 2. 14
[9] https:/ / github.com/ angular/ angular. js/ blob/ master/ CHANGELOG. md#1. 2. 13
[10] https:/ / github. com/ angular/ angular. js/ blob/ master/ CHANGELOG. md#1. 2. 12
[11] https:/ / github. com/ angular/ angular. js/ blob/ master/ CHANGELOG. md#1. 2. 11
[12] https:/ / github. com/ angular/ angular. js/ blob/ master/ CHANGELOG. md#1. 2. 10
[13] https:/ / github. com/ angular/ angular. js/ blob/ master/ CHANGELOG. md#1. 2. 9
[14] https:/ / github. com/ angular/ angular. js/ blob/ master/ CHANGELOG. md#1. 2. 8
[15] https:/ / github. com/ angular/ angular. js/ blob/ master/ CHANGELOG. md#1. 2. 7
[16] https:/ / github. com/ angular/ angular. js/ blob/ master/ CHANGELOG. md#1. 2. 6
[17] https:/ / github. com/ angular/ angular. js/ blob/ master/ CHANGELOG. md#1. 2. 5
[18] https:/ / github. com/ angular/ angular. js/ blob/ master/ CHANGELOG. md#1. 2. 4
[19] https:/ / github. com/ angular/ angular. js/ blob/ master/ CHANGELOG. md#1. 2. 3
[20] https:/ / github. com/ angular/ angular. js/ blob/ master/ CHANGELOG. md#1. 2. 2
[21] https:/ / github. com/ angular/ angular. js/ blob/ master/ CHANGELOG. md#121-underscore-empathy-2013-11-14
[22] https:/ / github. com/ angular/ angular. js/ blob/ master/ CHANGELOG. md#120-timely-delivery-2013-11-08
[23] https:/ / github. com/ angular/ angular. js/ blob/ master/ CHANGELOG. md#120-rc3-ferocious-twitch-2013-10-14
[24] https:/ / github. com/ angular/ angular. js/ blob/ master/ CHANGELOG. md#120-rc2-barehand-atomsplitting-2013-09-04
[25] https:/ / github. com/ angular/ angular. js/ blob/ master/ CHANGELOG. md#108-bubble-burst-2013-08-22
[26] https:/ / github. com/ angular/ angular. js/ blob/ master/ CHANGELOG. md#120-rc1-spooky-giraffe-2013-08-13
[27] https:/ / github. com/ angular/ angular. js/ blob/ master/ CHANGELOG. md#107-monochromatic-rainbow-2013-05-22
AngularJS
7
[28] https:/ / github. com/ angular/ angular. js/ blob/ master/ CHANGELOG. md#115-triangle-squarification-2013-05-22
[29] https:/ / github. com/ angular/ angular. js/ blob/ master/ CHANGELOG. md#1. 0. 6
[30] https:/ / github. com/ angular/ angular. js/ blob/ master/ CHANGELOG. md#114-quantum-manipulation-2013-04-03
[31] https:/ / github. com/ angular/ angular. js/ blob/ master/ CHANGELOG. md#113-radioactive-gargle-2013-02-20
[32] https:/ / github. com/ angular/ angular. js/ blob/ master/ CHANGELOG. md#105-flatulent-propulsion-2013-02-20
[33] https:/ / github. com/ angular/ angular. js/ blob/ master/ CHANGELOG. md
[34] http:/ / blog. angularjs. org/ 2012/ 09/ angularjs-102-debilitating-awesomeness. html
[35] http:/ / blog. angularjs. org/ 2012/ 06/ angularjs-101-thorium-shielding. html
[36] http:/ / blog. angularjs. org/ 2012/ 06/ angularjs-100rc12-regression. html
[37] http:/ / blog. angularjs. org/ 2012/ 06/ angularjs-100rc11-promise-resolution. html
[38] http:/ / blog. angularjs. org/ 2012/ 05/ angularjs-100rc10-tesseract. html
[39] http:/ / blog. angularjs. org/ 2012/ 05/ angularjs-100rc9-eggplant-teleportation. html
[40] https:/ / github. com/ angular/ angular. js/ blob/ master/ CHANGELOG. md#1. 0. 0rc8
[41] https:/ / github. com/ angular/ angular. js/ blob/ master/ CHANGELOG. md#1. 0. 0rc7
Further reading
Green, Brad; Seshadri, Shyam (March 22, 2013). AngularJS (http:/ / shop. oreilly. com/ product/ 0636920028055.
do) (1st ed.). O'Reilly Media. p.150. ISBN978-1449344856.
Kozlowski, Pawel; Darwin, Peter Bacon (August 23, 2013). Mastering Web Application Development with
AngularJS (http:/ / www. packtpub. com/ angularjs-web-application-development/ book) (1st ed.). Packt
Publishing. p.372. ISBN978-1782161820.
External links
Official website (http:/ / www. angularjs. org)
AngularJS Modules Repository (http:/ / ngmodules. org/ )
Built with AngularJS (http:/ / builtwith. angularjs. org/ )
AngularJS at Google Groups (https:/ / groups. google. com/ forum/ ?fromgroups#!forum/ angular)
AngularJS at Google+ (https:/ / plus. google. com/ + AngularJS/ posts)
Batarang Chrome plugin (https:/ / github. com/ angular/ angularjs-batarang)
NG-CONF 2014 Videos and Slides (http:/ / ng-conf. ng-learn. org/ )
Article Sources and Contributors
8
Article Sources and Contributors
AngularJS Source: http://en.wikipedia.org/w/index.php?oldid=599709567 Contributors: Abdull, Abondhal, AlmogBaku, Ambarish, Andyjsmith, Bitobor, Briantford, Chris the speller, Ckempo,
Command tab, Crazytonyi, Crimson117, Daniel.Cardenas, Danielzen, Dchestnykh, Delphinus1, Diagonalfish, Dyhorus, E8, Ethaniel, ForestMars, Frap, Ian01, Ianherb, Iiigooo, Jaemen, Jarble,
Jkurz25, Josepheames, Justinfreeman3, Kai4711x, Lindyboi, Marcelocantos, Micellius, Mnoon, MovGP0, Mysekurity, Owlmonkey, PaulHammant, Pigsonthewing, Pointillist, Quarterto,
Quebec99, Quibik, Reaverdrop, Rentar, Rotorcowboy, Ruby Murray, Rwalker, Serenic, Shruti14, Sirlantis, Snilan, Spadger, Sroberson, Tamtakoe, Thecircuitpress, Tomseddon, Udippuy,
Ventuc86, Vojta.jina, Wateresque, WikiLaurent, Yagazuzy, Yaron K., Yug, 96 anonymous edits
Image Sources, Licenses and Contributors
File:AngularJS logo.svg Source: http://en.wikipedia.org/w/index.php?title=File:AngularJS_logo.svg License: Creative Commons Attribution-Sharealike 3.0 Contributors: AngularJS
License
Creative Commons Attribution-Share Alike 3.0
//creativecommons.org/licenses/by-sa/3.0/

Você também pode gostar