Angular JS vs Angular 2+

  • Post author:
  • Post last modified:February 3, 2023
  • Post category:angular
  • Post comments:0 Comments
  • Reading time:3 mins read

Angular 2+ was a ground-up rewrite of AngularJS and has many unique features.

Angular JS is based on Java Script, while Angular 2+ is completely written in TypeScript

TypeScript is a super set of JavaScript with some advance features.

Angular does not have a concept of scope or controllers, instead it uses a hierarchy of components as its main architectural concept

Angular 2+ has different Expression Syntax, like [ ] for Property Binding and ( ) for Event Binding 

Angular 2+ is based on TypeScript. which introduces the following features :

  • Object Oriented Programming Concepts using Class and interface
  • Static Typing
  • Generics

Instead of Writing ng-module, ng-controller this are replaced by different metadata of class in Typescript like @NgModule, @Component, @Directive, @Service etc.

Structural directives syntax is changed. ng-repeat is replaced with *ngFor.

Angular 2 uses camelCase syntax for built-in directives. For example, ng-class is now ngClass and ng-model is now ngModel.

Advance Difference

Angular 1.x was not built with mobile support in mind, where Angular 2 is mobile oriented.

Angular 2+ provides more choice for languages. You can use any of the language from ES5, ES6, TypeScript or Dart to write Angular 2 code. Where, Angular 1.x has ES5, ES6 and Dart.

Angular 2+ is dependent on other libraries so it requires some time to setup, while Angular JS is easy to setup, all you need to add reference of library.

Angular Team have released Angular CLI to reduce the setup time. 

The Angular CLI is a command line interface tool that can create a project, add files, and perform a variety of ongoing development tasks such as testing, bundling, and deployment.

Summary

Angular 2 is completely different from Angular JS 1.x with more advance features, better code structure, Object Oriented Architecture using TypeScript, faster in performance than Angular JS.

You need not have to be aware with Angular JS 1.x to learn Angular 2+.