AngularJS is a JavaScript framework which can be added
to an HTML page with a script tag, AngularJS basically extends HTML attributes
with directives, and binds data to HTML with expressions. In other words, AngularJS is a powerful JavaScript
framework, used for developing Single Page Application (SPA) projects in very
clean and maintainable way.
AngularJS is an open-source web application framework, which helps the user to an efficient framework that can create Internet Applications, AngularJS provides developers an option to write client-side applications using JavaScript in a clean Model View Controller (MVC) way.
One should have a
basic understanding of JavaScript and any text editor, for developing web-based
applications using AngularJS, it will be good if one should have an
understanding of other web technologies such as HTML, CSS, AJAX, etc.
Why one should use AngularJS –
- Time-saving: me projects that used to take a lot of with other frameworks can now be completed faster with AngularJS
- The app is easy to learn and get started: -The easiest simplest thing a developer can imagine.
- Data Binding in AngularJS is very easy: Can you remember trying to create a text property on a model that requires binding to your app UI? It is very difficult with most frameworks.
- A declarative expression of UI: Because a UI with AngularJS is fully structured, understanding and manipulating the components are very easy.
- Affordability: Because AngularJS is an open-source framework, developers can come up with custom apps at lower costs.
The features of AngularJS are given as under −
· Data-binding − It is the automatic
synchronization of data between model and view components.
· Scope − are objects that refer to the
model. They act as glue between controller and view.
· Controller −
are JavaScript functions bound to a particular scope.
· Services − AngularJS comes with several built-in services such as $http to make an XMLHttpRequests. These are singleton objects which are instantiated only once in-app.
· Filters − select a subset of items from
an array and returns a new array.
· Directives − Directives are markers on DOM
elements such as elements, attributes, CSS, and more. These can be used to
create custom HTML tags that serve as new, custom widgets. AngularJS has
built-in directives such as ngBind, ngModel, etc.
· Templates − are the rendered view with
information from the controller and model. These can be a single file (such as
index.html) or multiple views in one page using partials.
· Routing − is a concept of switching views.
· Model View Whatever − MVW is a
design pattern for dividing an application into different parts called Model,
View, and Controller, each with distinct responsibilities. AngularJS does not
implement MVC in the traditional sense, but rather something closer to MVVM
(Model-View-ViewModel). The Angular JS team refers it humorously as Model View
Whatever.
· Deep Linking − allows encoding the state of
application in the URL so that it can be bookmarked. The application can then
be restored from the URL to the same state.
· Dependency Injection − AngularJS has a built-in dependency injection subsystem that helps the developer to create, understand, and test the applications easily.
The advantages of AngularJS are −
· It provides the capability to create Single Page Application in a very
clean and maintainable way.
· It provides data binding capability to HTML. Thus, it gives the user a rich
and responsive experience.
· AngularJS code is unit testable.
· AngularJS uses dependency injection and makes use of the separation of
concerns.
· AngularJS provides reusable components.
· With AngularJS, the developers can achieve more functionality with short
code.
· In AngularJS, views are pure HTML pages, and controllers are written in
JavaScript do business processing.
On top of everything, AngularJS applications can run on all major
browsers and smartphones, including Android and iOS-based phones/tablets.
Example of Angular JS
[code]<!DOCTYPE html>
<html lang="en-US">
<script
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<body>
<div ng-app="">
<p>Name : <input
type="text" ng-model="name"></p>
<h1>Hello {{name}}</h1>
</div>
</body>
</html>
The disadvantages of AngularJS are −
· Not Secure −
Being JavaScript only framework, application written in AngularJS are not safe.
Server-side authentication and authorization is must to keep an application
secure.
· Not degradable − If
the user of your application disables JavaScript, then nothing would be
visible, except the basic page.
- Services are similar in functionality to the factory.
- Factory allows us to return our own custom object.whereas in services the function which we assign to the service is the object.
- To create a service we make use of module.service();
- Services can have dependencies.
Example of Service
[code]
var CourseService = function()
{
Var course =[<course array>];
this.getcourses = function()
{
return courses ;
};
};
Factory
[code]Var courseFactory =function()
{
Var course =[<course array>];
Var factory ={};
Factory.getcourses=function()
{
return course;
};
return factory;
};
};
To know more on Angular JS visit our website for all the development courses
No comments:
Post a Comment