Menu Close

Difference between AngularJS and Angular 2

In this article we are going to discuss difference between AngularJS and Angular 2 in detail. Please read our previous article where we gave a brief Angular Versions and Versioning framework.

You can see the below in tabular format we differentiate between AngularJS and Angular 2.

Angular JSAngular 2
Released by Google in the year 2010.Released in Sept 2016.
JavaScript-based framework for creating SPA.Complete re-write of AngularJS version.
Still supported but no longer will be developed.It’s updated version regularly released because of Semantic Versioning.
The architecture of AngularJS is based on MVC.The architecture of Angular 2 is based on service/controller.
AngularJS was not developed with a mobile base in mind.Angular 2 is a mobile-oriented framework.
AngularJS code can write by using only ES5, ES6, and Dart.We can use ES5, ES6, Typescript to write an Angular 2 code.
Based on controllers whose scope is now over.Nowadays, the controllers are replaced by components, and Angular two is completely component based.
Factory, service, provider, value and constant are used for servicesThe class is the only method to define services in Angular2
Run on only client-sideRuns on client-side & server-side
ng-app and angular bootstrap function are used to initializebootstrapmodule() function is used to initialize

Angular 2 is an open source JavaScript framework to build web applications in HTML and JavaScript. This tutorial looks at the various aspects of Angular 2 framework which includes the basics of the framework, the setup of Angular and how to work with the various aspects of the framework. Other topics discussed in the tutorial are advanced chapters such as interfaces, nested components and services within Angular. Topics such as routing, modules, and arrays are also dealt with in this tutorial.

Features of Angular 2

Following are the key features of Angular 2 −

  • Components − The earlier version of Angular had a focus of Controllers but now has changed the focus to having components over controllers. Components help to build the applications into many modules. This helps in better maintaining the application over a period of time.
  • TypeScript − The newer version of Angular is based on TypeScript. This is a superset of JavaScript and is maintained by Microsoft.
  • Services − Services are a set of code that can be shared by different components of an application. So for example if you had a data component that picked data from a database, you could have it as a shared service that could be used across multiple applications.

In addition, Angular 2 has better event-handling capabilities, powerful templates, and better support for mobile devices.

Components of Angular 2

Angular 2 has the following components −

  • Modules − This is used to break up the application into logical pieces of code. Each piece of code or module is designed to perform a single task.
  • Component − This can be used to bring the modules together.
  • Templates − This is used to define the views of an Angular JS application.
  • Metadata − This can be used to add more data to an Angular JS class.
  • Service − This is used to create components which can be shared across the entire application.

Conclusion

In this lesson we discussed about difference between AngularJS and Angular 2. Angular 2 is an open source JavaScript framework to build web applications in HTML and JavaScript.

Jayant Tripathy
Coder, Blogger, YouTuber

A passionate developer keep focus on learning and working on new technology.

Leave a Reply

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