What
is AngularJS?
AngularJS is JavaScript open source framework was
developed in 2009 by Misko Hevery and Adam Abrons. Now it is maintained by
Google. It is used to build web applications and essay to use, modify and
sharable. It is very powerful framework that helps to create Single Page
Applications (SPA), MVC pattern applications. It is also useful to develop
dynamic web apps.
AngularJS supports to Model-View-Whatever (MV**, **whatever you want to do)
AngularJS supports to Model-View-Whatever (MV**, **whatever you want to do)
What
are AngularJS Features?
AngularJS
Controllers
It is responsible to control the data or in other
word, AngularJS controller is used to manage the flow of data of AngularJS
application. ng-controller directive define the controller class to view.
Attributes/properties and functions can be define in a controller. AngularJS
invokes the controller with a $scope object.
Use
controllers to:
1:- Set up the initial state of the $scope
object.
2:- Add behaviour to the $scope object.
2:- Add behaviour to the $scope object.
Do
not use controllers to:
1:- Manipulate DOM
2:- Format input
3:- Filter output
4:- Share code or state across controllers
2:- Format input
3:- Filter output
4:- Share code or state across controllers
AngularJS
Directives
Directives are attributes starting with ng-
prefix that provide the way to you to extend the HTML with new attributes
called Directives.
AngularJS provides lot of build-in directives
that can be used to extend the html. You can also create your own (custom)
directives.
Following
are the most common directives:
ng-app:
This directive starts an AngularJS Application.
ng-init:
This directive initializes application data.
ng-model:
This directive defines the model that is variable to be used in AngularJS.
AngularJS
Expressions
AngularJS Expressions are used to bind data to view
(HTML) that can be written inside double braces: {{expression}}
AngularJS
Data Binding
AngularJS provides way to bind the model to view
and vice versa. It works like bridge between the model and the view. It support
two-way binding means if data changes in model, the data on the view also
reflects with the changes, Also if data in the view changes, the model data
will updated immediately and automatically .
AngularJS
Module
AngularJS Module is container that contains the
different parts of your application like filters, controllers, directives,
services, etc. that lets you, how an application should be bootstrapped. Any library
should be specifying in the module that you want to use.
AngularJS
Scope ($scope)
Scope is an object that refers to the application
to binding between the HTML and controller. The application can have multiple
scopes, because directives can create new child scopes. When new scopes are
created, they are added as children of their parent scope.
Root
Scope ($rootScope)
There will be a single root scope in application.
All other scopes is created in application is sub scopes of the root scope.
Scopes provide separation between the view and the model.
AngularJS
Filters
AngularJS Filters is used to format the value for
display to the end users. It can be used in services, view templates or
controllers. By using pipe (|) character, you can add angular filters.
AngularJS provides below list of built-in filters
filter
|
Selects a subset of items from array and returns it as a new
array.
|
currency
|
Formats a number as a currency.
|
number
|
Formats a number as text.
|
date
|
Formats date to a string based on the requested format.
|
json
|
Allows you to convert a JavaScript object into JSON string.
|
lowercase
|
Converts string to lowercase.
|
uppercase
|
Converts string to uppercase.
|
limitTo
|
Creates a new array or string containing only a specified number of
elements.
|
orderBy
|
Orders an array by an expression
|
Thank you so much for sharing this pretty website, it was so good to read and useful to improve my knowledge as
ReplyDeleteThanks
Delete