AngularJS

AngularJS, commonly referred to as Angular, is an open-source web application framework maintained by Google and a community of individual developers and corporations to address many of the challenges encountered in developing single-page applications. Its goal is to simplify both development and testing of such applications by providing a framework for client-side model–view–controller (MVC) architecture, along with components commonly used in rich internet applications.

The library works by first reading the HTML page, which has embedded into it additional custom tag attributes. Those attributes are interpreted as directives telling Angular to bind input or output parts of the page to a model that is represented by standard JavaScript variables. The values of those JavaScript variables can be manually set within the code, or retrieved from static or dynamic JSON resources.

Features

  • AngularJS is a powerful JavaScript based development framework to create RICH Internet Application(RIA).

  • AngulajJS provides developers options to write client side application (using JavaScript) in a clean MVC(Model View Controller) way.

  • Application written in AngularJS is cross-browser compliant. AngularJS automatically handles javascript code suitable for each browser.

  • AngularJS is open source, completely free, and used by thousands of developers around the world. It is licensed under the Apache License version 2.0.

Overall, AngularJS is a framework to build large scale and high performance web appliation while keeping them as easy-to-maintain.

Advantages of AngularJS

  • AngularJS provides capability to create Single Page Application in a very clean and maintainable way.

  • AngularJS provides data binding capability to HTML thus giving user a rich and responsive experience

  • AngularJS code is unit testable.

  • AngularJS uses dependency injection and make use of sepearation of concerens.

  • AngularJS provides reusable components.

  • With AngularJS, developer write less code and get more functionality.

  • In AngularJS, views are pure html pages, and controllers written in javascript do the business processing.

On top of everything, AngularJS applications can run on all major browsers and smart phones including Android and iOS based phones/tablets.

Disadvantages of AngulaJS

Though AngularJS comes with lots of plus points but same time we should consider the following points:

  • 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 your application user disables Javascript then user will just see the basic page and nothing more.

The AngularJS Components

The AngularJS framework can be divided into following three major parts:

  • ng-app : This directive defines and links an AngularJS application to HTML.

  • ng-model : This directive binds the values of AngularJS application data to HTML input controls.

  • ng-bind : This directive bins the AngularJS Application data to HTML tags.

Basic Example:

<!DOCTYPE html> <html>

<head> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> </head>

<body>

<div ng-app=""> <p>Name: <input type="text" ng-model="name"></p> <p>{{name}}</p> </div>

</body> </html>

Another Example

Cost calculation

<!DOCTYPE html> <html>

<head> <script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> </head>

<body>

<div data-ng-app="" data-ng-init="quantity=1;price=5">

<h2>Cost Calculator</h2>

Quantity: <input type="number" ng-model="quantity"> Price: <input type="number" ng-model="price">

<p><b>Total in dollar:</b> {{quantity * price}}</p>

</div>

</body> </html>

Out Put Capture

When you open the link https://angularjs.org/, you will see there are two options to download AngularJS library.