What is the difference between Angular 2 and Angular 4? - LearnHowToCode SarkariResult.com Interview Questions and Answers LearnHowToCodeOnline
What is the difference between Angular 2 and Angular 4?

What is the difference between Angular 2 and Angular 4?

Well there is no path breaking change that means Angular 4 is not a complete rewrite of Angular 2 .
Google has adapted SEMVER (Semantic versioning) approach for it’s Angular Framework.
  • Why not Angular 3?
Due to misalignment of router package version . As @angular/router was using v3.3 already , so they switch to Angular 4 Finally .
  • What has Changed?
Angular team has laid emphasis on making angular apps more faster,compact .
Under the Hood Changes
New changes reduce the size of the generated code for your components by around 60% in most cases.
The more complex your templates are, the higher the savings.
Faster Compilation
Better Bug fixes Alert.
Some changes in Imports/Syntax
  • Animations being pulled out of @angular/core so as to remove the extra code being imported into our production bundle .Though you can easliy add animation by importing {BrowserAnimationsModule} from @angular/platform-browser/animations into NgModule.
  • Renderer 2 in place of Renderer from same ‘@angular/core’.
  • *ngIf/else : Now you can use else clause as well .
  • For email validation in Angular forms
  1. Earlier Angular 2 : pattern = “[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?”
  2. Now Angular 4: Now just put email as an attribute to input field where you want to have email id .Here email is an angular directive not to confuse with the type=”email” which is just an HTML DOM type property .
  • TypeScript 2.1 and 2.2 compatibility: Finally We can use typescript 2.1 or more earlier only upto typescript 1.8 was supported.
So that’ s all has changed .
NOTE :
Since the arrival of Angular 2 and Angular 4.The complete framework is referred as Angular not AngularJs as the latter one refers to the Angular1.x framework.

About Mariano

I'm Ethan Mariano a software engineer by profession and reader/writter by passion.I have good understanding and knowledge of AngularJS, Database, javascript, web development, digital marketing and exploring other technologies related to Software development.

0 comments:

Featured post

Political Full Forms List

Acronym Full Form MLA Member of Legislative Assembly RSS Really Simple Syndication, Rashtriya Swayamsevak Sangh UNESCO United Nations E...

Powered by Blogger.