Blog

An introduction to AngularJS

What is Angular JS?

  • AngularJS (commonly known as “Angular” or “Angular.js”) is an open-source web application framework mainly maintained by Google and by a community of individual.
  • AngularJS is a JavaScript framework. It can be added to an HTML page with a <script> tag.
  • AngularJS extends HTML attributes with Directives, and binds data to HTML with Expressions.
  • AngularJS is a JavaScript framework. It is a library written in JavaScript.

AngularJS Extends HTML:

AngularJS extends HTML with ng-directives.

  • The ng-app directive defines an AngularJS application.
  • The ng-model directive binds the value of HTML controls (input, select, textarea) to application data.
  • The ng-bind directive binds application data to the HTML view.

Simple Angular JS Example:


<!DOCTYPE html>
 <html>
 <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js">
</script>
 <body>
<div ng-app="">
 <p>Name: <input type="text" ng-model="name"></p>
 <p ng-bind="name"></p>
 </div>
</body>
 </html>

Why Angular JS:

Image result for angular js

Here are some reasons why you should be using Angular today.

  • MVC Done,
  • A declarative User interface,
  • Write less code,
  • Behavior with directives,
  • Flexibility with filters.

Alternatives:

Other frameworks deal with HTML’s shortcomings by either abstracting away HTML, CSS, and/or JavaScript or by providing an imperative way for manipulating the DOM.

Advantages of Angular JS:

On the other hand, Angular JS is a framework. It provides a lot of features that you don’t get with using a library like jQuery

  1. Templates
  2. Two way data binding
  3. Form Validations
  4. Deep Linking for dynamic pages
  5. MVW pattern (similar to MVC)
  6. Communication with server
  7. Reusable components and localization to name a few

 

Awadhesh Kumar

Jain Software Developers