Change is inevitable and things are constantly changing with the programming too. Angular 4 has been released in March 2017. Many of you may be getting swarmed with rapidly flowing thoughts, like: What about version 3”? Well, unfortunately, there’s no Angular 3. We have Angular 4. But I have started to learn Angular 2 and now what should I be doing? Should I start to learn Angular 4 and forget about version 2?
The answer is no!
The newest version is backward compatible with 2.x.x version. It’s just an evolution rather than revolution. However, in case of Angular, fortunately, the development team has done us a favor with what they are referring “invisible-makeover”.
Here are the six reasons why should you consider updating to Angular 4:
1. Angular 4 is smaller than Angular 2- Applications are smaller and faster–the size of the generated code was reduced by around 60%.
2. Angular 4 is undeniably much faster than Angular 2- The speed enhancement is really an appreciating job.
3. Angular 4 has enhanced *ngIf and *ngFor.
4. Angular 4 is universal – project that allows devs to run Angular on a server.
5. Typescript 2.1 and 2.2 compatibility- The Angular team has updated to a more recent version of TypeScript. It will increase the speed of ngc and you will get the improved type checking throughout your app.
6. Source maps for templates – when there is an error in a template, source maps are generated and more will come soon with v 4.1.
Upgrade Angular 2 Project to Angular 4
If Angular 4 has been released, why not to use it in our new project? Let’s see if it is easy to upgrade Angular 2 project to Angular 4.
Open command line tool, go to app folder and type commands as below, then wait for a little.
After that, we can check the version of angular in our app by the following command
If the above commands executed fine, you will see below screen which says you are currently on Angular 4.0.3.
Interestingly, it wasn’t that long ago, when Angular 2 was announced as a rejuvenated version of Angular. Angular 2 is more than just a next version of Angular. So, going forward, it seems like the Angular team is going to skip version 3.0 and go straight to version 4.0. Almost all of the Angular 2 applications will perform perfectly fine using Angular 4 without changing anything. It’s not a monumental upgrade, I mean in terms of apparent changes, however; it offers a significant enhancement to Angular 2. The version 4.0 of Angular has been available since March 2017.