Você está na página 1de 4

AngularJS:- is an open-source JavaScript framework developed by Google that is i

ntended to make it easier to implement RIA web applications or one-page web appl
ications. It is based on MVC pattern and allows to build well structured, easil
y testable, and maintainable front-end applications.
-----Angular JS Features :- Feature 1-Two way data binding:- One of the coolest and m
ost useful feature in AngularJS is Two Way Data-Binding because A typical web ap
plication consist if 80% of its code base is dedicated to traversing, manipula
ting, and listening to the DOM. Data-binding makes this code disappear, so you c
an focus on your application. Data-binding handles the synchronization between t
he DOM and the model, and vice versa.
Feature 2- Templates :- AngularJS uses the just plain-old-HTML but with vocab
ulary is extended, to contain instructions on how the model should be projected
into the view.The HTML templates are parsed by the browser into the DOM. The DOM
then becomes the input to the AngularJS compiler.That is data-bindings are DOM
transformations, not string concatenations or innerHTML changes - no string man
upulation involved Feature 3- MVC:- It is based on MVC pattern which helps to organize our web ap
plication properly. The model is simply the data in the application. A viewmodel
is an object that provides specific data and methods to maintain specific views
. Controller is a function which actually contains the logical unit of the appli
cation. Template/View is the HTML part of the application/the presentation of da
ta in a particular format
The $scope has a reference to the data, the controller defines behavior, and the
view handles the layout and handing off interaction to the controller to respon
d accordingly.
Feature 4-Dependency Injection:- which helps the developer by making the applica
tion easier to develop, understand, and test.
Feature 5-Directives:- are my personal favorite feature of AngularJS and It can
be used to create custom HTML tags can also be used to "decorate" elements with
new behavior and manipulate DOM attributes in interesting ways.
AngularJS is written entirely from the ground up to be testable. It even comes w
ith an end-to-end and unit test runner setup
AngularJS is matured community to help and thus we have very support over the in
ternet.
-------jQLite:- is a subset of jQuery that is built directly into AngularJS. jQLite pro
vides you all the useful features of jQuery. In fact it provides you limited fea
tures or functions of jQuery. Basically, angular.element() is an alias for the j
Query function { angular.element() === jQuery() === $() }
AngularJS 1.3 support Safari, Chrome, Firefox, Opera 15+, IE9+ and mobile browse
rs. AngularJS 1.3 has dropped support for IE8 but AngularJS 1.2 will continue to
support IE8.
Current Ver 1.4.3 size of the compressed and minified file is < 140KB. full ver
0.99MB
AngularJS features?
1. Modules
2. Directives

3. Templates
4. Scope
5. Expressions
6. Data Binding
7. MVC (Model, View & Controller)
8. Validations
9. Filters
10. Services
11. Routing
12. Dependency Injection
13. Testing
AngularJS Security :- Prevent HTML injection attacks,Cross-Site-Scripting (CSS)
attacks and XSRF protection for server side communication.
AngularJS directives:- are used to extend HTML or to tell AnguluarJS how to m
ix the data into the HTML template
Interpolation Directive :- The interpolation directive inserts the result of an
expression into the HTML template. You mark where to insert the expression using
the {{ }} notation
ng-bind Directive :- is an alternative to the interpolation directive. This wil
l insert the data into the body of the html element
ng-bind-html-unsafe :- disable the HTML escaping
The ng-show and ng-hide directives are used to show or hide an HTML element depe
nding on data in the model
The ng-switch directive is used if you want to add or remove HTML elements from
the DOM based on data in the model.
The main difference between ng-if and ng-show + ng-hide is that ng-if removes th
e HTML element completely from the DOM, whereas the ng-show + ng-hide just appli
es the CSS property display: none; to the elements.
The ng-include directive can be used to include HTML fragments from other files
into the view's HTML template
The ng-repeat directive is used to iterate over a collection of items and genera
te HTML from it
AngularJS event listener directives:- is used to attach an event listener to an
HTML element using these directives Eg ng-click
Scope:- is a JavaScript object that refers to the application model which is use
d for communication between controller and view.
$rootScope - The $rootScope is the top-most scope which will be shared among all
the components of an app it acts like a global variable. All other $scopes are
children of the $rootScope.
AngularJS is compiled:- 1. Compile - It traverse the DOM and collect all of the
directives. The result is a linking function, 2. Link - It combines the directiv
es with a scope and produces a live view.
Directives are compiled? :- The $compile traverses the DOM and looks for directi
ves. For each directive it finds, it adds it to a list of directives. Then, each
directive s own compile function is executed,Each compile function returns a linkin
g function, which is then composed into a combined linking function and returned

.Then $compile links the template with the scope by calling the combined linking
function from the previous step
One-way data binding - This binding is introduced in Angular 1.3. An expression
that starts with double colon (::)Avoid unnecessary observing of variables on sc
ope object, angular introduced one-way data binding.
Isolate Scope:- By default, directives have access to the parent scope in Angula
rJS apps.You can isolate the scope in a directive by adding a scope property int
o the directive
AngularJS provides $on, $emit, and $broadcast services for event-based communica
tion between controllers.
$emit:- The event life cycle starts at the scope on which $emit was called. The
event traverses upwards toward the root scope and calls all registered listeners
along the way.
$emit
It dispatches an event name upwards through the scope hierarchy
$broadcast It dispatches an event name downwards to all child scopes
$on
It can catch/listen the event dispatched by $broadcast and $emit.
AngularJS provides you built-in validation directives [ng-required],[ng-minlengt
h] etc
Form properties:- $valid - It is a boolean property that tells whether the form
or it's inputs are valid or not.
$invalid - It is a boolean property that tells whether the form or it's inputs a
re invalid or not
$pristine - It is a boolean property that tells whether the form or it's inputs
are unmodified by the user or not
$dirty - It is a boolean property that is actually just reverse of pristine i.e.
it tells whether the form or it's inputs are modified by the user or not.
$error - This is an object hash which contains references to all invalid control
s or forms.
A service:- is a reusable singleton object which is used to organize and share c
ode across your app. A service can be injected into controllers, filters, direct
ives
AngularJS offers several built-in services (like $http, $provide, $resource, $wi
ndow, $parse) which always start with $ sign.
There are five ways to create a service as given below:
1. Service
2. Factory
3. Provider
4. Value
5. Constant

Factory Provider:- You just create an object, add properties to it, then return
that same objec.
Service Provider:- You just instantiated with the new
keyword and you ll add properti
this
and the service will return this .
Factory is mostly preferable in all cases. It can be used when you have construc
tor function which needs to be instantiated in different controllers.
Service is a kind of Singleton Object. The Object return from Service will be sa
me for all controller. It can be used when you want to have single object for en
tire application. Eg: Authenticated user details.
Provider - A provider is used to create a configurable service object. It return
s value by using $get() function.

Note, service, factory, and value are all derived from provider.

Você também pode gostar