what’s new in angular 4 ? why angular 4 not 3 ?

what’s new in angular 4. why angular 4 not 3
Reading Time: 2 minutes

I am excited to announce that angular 4 has released in march, 2017. after the huge success of angular 2, the Angular team has decided to launch improved version of angular 2. You might be thinking why not angular 3. It’s because of the internal versioning of angular router 3.x. they have to launch angular 3.x and router 4.x. so they decided to launch everything to 4.x.

 

If you are familiar with angular 2 then you can easily upgrade to angular 4. Your angular 2 code will still work in angular 4 but it is advisable that you should not use deprecated code because it might not be used in angular 5 or future versions. For now, you can upgrade your old app to angular 4 without any issue. Let’s see what are things changed in angular 4. For complete change log. Please visit angular GitHub page: – angular change log git hub page

  • Ahead of time compilation – View engine
    We were having large bundle size earlier after compiling the typescript code. so, they have introduced a new view engine which reduces the code size to 60% less.
  • If else block
    Earlier we had only If statement. Now we have else part too. So, this gives a great flexibility in writing code. let’s see the example.
  • The new Renderer2 class
    We now have renderer2 class in place of renderer class. You can use both because it is not removed from angular 4 but it may be removed in the future version so you can upgrade your code to the latest version.
  • Email validator
    Earlier we don’t have any built-in email validator. we have to use pattern email validator to validate email. Now, we can use email validator by using email directive. It’s pretty easy.
  • Typescript 2.2
    Earlier we had typescript 1.8+ version. Now, angular had updated the typescript version. you can see the latest features of typescript 2.2 in the offical documentation.
  • The angular animation package
    Now angular animation package is introduced. earlier we used to import it from @angular/core but now we have the separate package for angular animation @angular/animations. You will still use the animation in the same way but importing it in the project has changed.

Summary
Overall, there are not any changes that can break your existing app. so, you can upgrade to angular 4 and use new features without any trouble. The performance and size of the app have improved in this new version. The new version angular 5 may release in this year September with many more features.

Leave a Reply

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