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 extends HTML attributes with Directives, and binds data to HTML with Expressions.
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>
Why 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.
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
- Two way data binding
- Form Validations
- Deep Linking for dynamic pages
- MVW pattern (similar to MVC)
- Communication with server
- Reusable components and localization to name a few