AngularJS vs Angular 2

Most of the sources say that the biggest difference and the reason we cannot call them the same framework is the structure. AngularJS was based on the Model View Controller (MCV) while Angular 2 is based on the component structure.

What else?

  1. Angular 2 uses TypeScript (as all the versions after 2). Angular 2 allows using those languages: ES5, ES6, TypeScript, Dart while AngularJS  allows only ES5, ES6, Dart
  2. Angular 2 uses Hierarchical Dependency Injection (AngularJS not)
  3. The Structural directives’ syntax was altered from ng-repeat (AngularJS) to *ng-for (Angular 2+)
  4. In Angular 2 the local variables are defined by a hash prefix
  5. Angular 2 – use of Dependency Injection
  6. In spite, all the new changes Angular 2 is a bit (20 kb) lighter than AngularJS.
  7. When AngularJS was built no one thought of the mobile devices while Angular 2 is mobile-friendly.
  8. Angular 2 provided camelCase syntax
  9. The $scope was a main concept of the AngularJS but there’s no $scope in Angular 2. In Angular 2 you use this instead.
  10. Components (Angular 2) instead of controllers (AngularJS)

As you can see above there are multiple changes, so we can agree that if you already have a project based on AngularJS and you want to move to Angular 2 or higher it would be easier to create a new project than change one line after another.

You may also like...