How to create projects with different Angular Versions?

Google’s opensource framework Angular is one of the leading javascript frameworks currently in the market. Google is taking this lead seriously and keeps upgrading it to get the best of javascript. But this comes a cost for the users, the developers working on the different project would have to work with multiple Angular versions in their system. Sadly, there is nothing like “Node Version Manager (NVM)” that can allow you to switch between versions of angular. But, there is a simple workaround that we are using at Third Rock Techkno. We install Angular-CLI in project folders and not globally.

I have demonstrated how we can do it in a Windows machine. You can follow a similar approach for whichever OS you are using.

You need to follow the steps below and you should have a local installation of Angular versions.

Step 1 : Create a folder in one of your local computer drives. I would like to create an Angular 4 project. For the demonstration, I have created the ‘angular-4-projects’ folder in my D Drive.

Step 2 : Open your cmd (Command prompt) and navigate to “angular-4-projects” that you recently created in the D drive of your machine. In my case, the path would be D:/angular-4-projects

Step 3 : Now install Angular-CLI 1.4.x because that is the version that will install Angular 4 in to your project folder. You need to make sure while installation you are not using -g at the end of the installation command. If you use this -g than Angular- CLI 1.4.x will install globally on your machine. Here is the installing command syntax npm install @angular/cli@

Ex (For angular-4): npm install @angular/cli@1.4.x
Ex (For angular-5): npm install @angular/cli@1.5.x
Ex (For angular-6): npm install @angular/cli@6.x.x

Note: After angular 6 the Angular-CLI version is the same as the Angular version.

Now, if you want to find which Angular-CLI version to use for which version of Angular you can find that here https://www.npmjs.com/package/@angular/cli. Once you land on the website you need to navigate to the versions tab and look into the documentation of the specific versions.

For the angular 4 i can use 1.6.x that come before 2 year from Now (Nov-2019)

Step 4 : Now create your angular version project inside that folder using command prompt.

ng new <project-name>

For demonstration, I am creating a project “angulr4demo”

ng new angular4demo

Step 5 : You can check the new project’s version by opening the package.json.

Now that you have seen how you can locally install the Angular-CLI that will allow you to run multiple Angular version in your system simultaneously, go ahead keep creating wonderful projects.

· · · ·

Third Rock Techkno is a leading IT services company. We are a top-ranked web, voice and mobile app development company with over 10 years of experience. Client success forms the core of our value system.

We have expertise in the latest technologies including angular, react native, iOs, Android and more. Third Rock Techkno has developed smart, scalable and innovative solutions for clients across a host of industries.

Our team of dedicated developers combine their knowledge and skills to develop and deliver web and mobile apps that boost business and increase output for our clients.

7 Reasons Why Angular is The Future of Enterprise-Scale Web Applications

Angular is an open-source, dynamic and full-featured framework developed by Google. A number of large companies have used Angular to build powerful and stable large scale enterprise applications.

Read More

Why You Should Upgrade AngularJS to Angular For Your Web Apps

If you are considering whether you should upgrade AngularJS to Angular for your web applications, the answer is yes and now is the time to take the leap.

Read More

4 things to ponder when outsourcing to a Node JS development company

Various factors play a role in your decision to outsource to a Node JS development company. Here are the important things you need to consider for right decision making.

Read More