Should you be using AngularJS or jQuery? Today we will talk about the difference between the two.
Let’s start by going over what AngularJS really is.
AngularJS has the following features:
- Two way data binding
- MVW pattern (MVC-ish)
- Custom-directive (reusable components, custom markup)
- Deep Linking (set up a link for any dynamic page)
- Form Validation
- Server Communication
- Dependency injection
- Full testing environment (both unit, e2e)
If you are developing a heavy web applications, AngularJS is for you. AngularJS can use jQuery if it’s present in your app when the application is being bootstrapped. If jQuery is not present in your script path, AngularJS falls back to its own implementation of the subset of jQuery that we call jQLite.
Web Applications (not Websites)
The Document Object Model (DOM) is an application programming interface (API) for valid HTML and well-formed XML documents.The jQuery library contains the following features:
- HTML/DOM manipulation
- CSS manipulation
- HTML event methods
- Effects and animations
<input type="text" ng-model="yourName" placeholder="Enter a name here">
Below is a live example of AngularJS at work. Example:
var yourName= $("#yourName").val();
<input type="text" id="yourName" placeholder="Enter a name here">
<h1>Hello <b id="output">!</b></h1>
Below is a live example of jQuery at work. Example:
I hope this answers some, if not all of your questions about the difference between AngularJS and jQuery.Thanks for reading!