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:
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
- Templates
- 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
Awadhesh Kumar