Angular Js

From Rasim SEN - Knowledge Base/Java/Springframework/Microservices/Cloud-AWS/AI
Jump to: navigation, search

Differences Between Angular 4 and Angular 5

Angular JS was developed in 2009 by Miko Hevery at Brat Tech LLC, as front-end web development application. Based on JavaScript, Angular JS is an open-source framework built on the concept of connecting the software components and creating user interfaces. The framework is currently maintained by Google.

Angular JS was mainly built –

To provide a proper architecture to the application, throughout its life cycle, from UI designing to testing phase. To provide a modular architecture to the application, so that client end and server end of the application can be designed and developed parallelly. • To enable the developers to design DOM (Document Object Model) independent application logic.

The framework gained substantial popularity among web developers. As promised by Google, to make Angular JS more user friendly and effective, it is updated twice a year.

Angular 4

Apart from being a major release jump from version 2, Angular 4 also had many new features along with changes which were non-compatible with the previous versions. Few of these interesting new features were:

  • Router ParamMap: Till Angular 2, key-value object structure was used to store route parameters, which make it accessible only via using standard JavaScript syntax (parameterObjekt[‘parameter-name’]). From Angular 4, the parameters were made available in the form of a map & can be executed by simple method calls.
  • Dynamic Components with NgComponentOutlet: *ngComponentOutlet directive enables the web developer to develop dynamic components in a declarative way.
  • Animation:To ensure that the application package is not heavy due to additional coding, which is not required for the specific application, Animations were put into a separate package of its own, which were earlier part of @angular/core module
  • TypeScript 2.1/2.2: Angular 4 improved the Type security of the applications and the speed at which the ngc-Complier executes. This will help ensuring coding faults like defining a variable & telling TypeScript that “null” and “undefined” can be entered as the variable’s value.
  • HTTP Request Simplified: Adding parameters to the “HTTP” request, to perform a search operation has been simplified.
  • Service: To perform the get or update operations, a new service was introduced, known as “Meta tags”

Angular 5

On the other hand, when Angular 5 was released, it came with a whole bunch of additional and new features, service improvements and bug fixes. Some of these features were actually, a pleasant surprise for the existing Angular users as well. We have listed down few very interesting features for our readers, so that they can easily understand the difference between the two versions.

  • Build Optimizer: This is a tool which was included in the CLI to help the developers in creating a smaller bundle for the application. Apart from decreasing the users’ bundle size, the feature also helps in increasing the boot speed of the application for the users.
  • Compiler Improvements: To enhance faster rebuilds for production and AOT (Ahead of Time) builds, Angular 5 supports incremental compilation.
  • New Router Lifecycle Events:This new feature was added to enable the developers in tracking the cycle of the router, starting from running guards to the completion of activation.
  • HttpClient: This feature has been recommended for all the application as HTTPClient was highly appreciated. The framework developer are not suggesting anymore, to use the previous @angular/http library. Developers can update the HTTPClient in 3 easy steps:

In each module, replace HttpModule with Http Client Module from @angular/common/http.

  • Inject the HttpClient service
  • remove any map(res =>res.json()) calls, which are no longer needed.