Upgrade project from Angular 2.0 to Angular 4.0

 

This article covers how to upgrade a project from angular 2 to angular 4, as part of this up-gradation I am going to take simple demo project which was covered in my previous article, you can refer this link for demo project and it is developed on  angular 2 forms , the project contains two components, registration and thank you components along with the registration service

Step 1:

The first thing which I did is I ran the below command to upgrade dependencies to latest version

Once the upgradations successful then I ran the “ng-serve” command, the user registration form works well, I did not see any issues

Step 2:

if you are using <template> in your components html then we need to rename it to <ng-template>

Change above <template> code to <ng-template>

Step 3

Before upgrading to angular 4, the classes should not  extends OnInit,  instead of use implements

The above mentioned steps are applicable for simple project but if you have more complex functionalities then I would  recommend you read this article