Angular.js for jQuery developers

JavaScript was created back in 1995 but made a comeback with the introduction of Ajax and jQuery in 2006. Nowadays, over 60% of the 10000 top visited websites in the world use jQuery and most front end developers are familiar with Javascript and jQuery.

But since jQuery is so popular, why invest time into learning a new JavaScript Framework?

Framework vs Library

The first difference is a big one, jQuery is a library and Angular.js is a framework. What does that mean? A library provides some useful utilities in order to make things simpler and faster. Combine that with the uncountable jQuery plugins and you can do almost anything. A framework on the other side, offers a very specific project architecture that helps a developer organize his code, make it modular and DRY and also comes with preinstalled and required libraries. In fact, Angular.js has the jqLite library included, which is a limited version of jQuery.

UI Encapsulation

To create an accordion with jQuery, you will probably try to find a jQuery plugin and read the instructions on how to implement it. Implementation includes adding the required elements, a few divs, a list, list items and maybe even more. Why not just add an element. Angular.js can create new HTML elements called directives that encapsulate HTML multiple elements and JavaScript functionality.

SPA (Single Page Application)

Websites built with Angular.js are Single Page Applications. SPAs are very fast and responsive on user interaction. This is possible by the MVW architecture (explained below) that separate the data from the presentation of data. Of course SPAs have some disadvantages like the Search Engines index crawlers that most can’t run JavaScript, and thus can’t index SPAs. Since Angular.js in built by Google, it was expected that Google Search will soon start to support it, and the first steps are already done.

MVW (Model View Whatever)

Most modern frameworks implement an MVC architecture and so does Angular.js but allows for simple applications that don’t implement controllers. The separation of Model and View allows for cleaner code, distinctive purposes for each file, and maybe even different developers working on them based on their specialty.

Final Thoughts

Angular.js is not a jQuery replacement, but it is certainly something that will be in the Javascript scene spotlight for the years to come. Although it is a very powerful framework, it is not the best solution for all projects. For example a SEO critical website, might be better suited for a more traditional implementation at the moment, but for generic web applications Angular.js is the way to go.

Leave a Reply

Your email address will not be published. Required fields are marked *