Bernardao
Bernardao

Reputation: 500

Angular CLI - create a new project choosing Angular2 version

Good morning, I'm trying to use Angular CLI to start a project in Angular 2 and not in Angular 4, I mean I would like to use version 2.4.10 for example. There are any way to create it using Angular CLI, can't find which parameters I need to use or if it's possible, I would apreciate any help, Googling I haven't found anything.

I mean, if I type ng new myProject, this project is create in Angular4.

Thank you very much

Upvotes: 0

Views: 620

Answers (2)

R. Richards
R. Richards

Reputation: 25161

If you want to use an earlier version of Angular in a project created using the latest version of the CLI, the after creation is complete you'll have to change the @angular versions in the package.json to what you need, and run npm install for that project.

Note: If you go back to 2.4.10, then make sure the @angular/router version you use is 3.4.10.

You can still use the CLI to generate code, and you shouldn't see any insurmountable issues, if you see any at all.

The latest version of the CLI only supports creating new projects with ng4, and newer. What you do with the code after that is entirely up to you.

Upvotes: 1

karser
karser

Reputation: 1693

angular-cli v1.0.0 uses angular ^4.0.0 and there is no option to change it.

But it seems like v1.0.0-rc.4 uses ^2.4.0 by default. And it seems there is an option ng new <name> --ng4 to use angular4.

Btw ^4.0.0 is backward compatible with 2.4.

Upvotes: 2

Related Questions