How to generate a new Angular 4 project instead of creating generating Angular 6?

how to create folder in angular project
ng generate component
create angular 7 project
ng generate routing module
ng generate component in folder
ng new
ng generate component path
angular material

I recently just installed Angular on my Ubuntu 16.04 computer following the documentation found here. But when i generate a new Angular project, it generates Angular 6.

How do i generate specific angular 4 project?

You can following these steps to generate an Angular 4 project

> npm remove -g @angular/cli
> npm install -g @angular/cli@1.4.10
> ng --version
  @angular/cli: 1.4.10
> ng new myangular4

Assuming that you already have angular cli installed in your system, the steps above will remove the current angular cli installed an will be replaced by an angular cli that can generate Angular 4.

ng generate, Create a Feature Component · 4. Add Services · 5. Add In-app Navigation · 6. Get Data from a Server Generates a new basic app definition in the "projects" subfolder of the workspace. When true, does not create "spec.ts" test files for the new class. Default: false Deprecated: Use "skipTests" instead. When true (​the  We have our Angular 6 development environment ready so Let’s create a new angular 6 project using the angular CLI command. Let’s see what files generate without actually creating them these are the files generated as part of the new Angular 6 Project. because we have used the dry run flag angular CLI.

Try the follow command in your project folder,

npm install @angular/

Read the changelog

And if you want to change the CLI version globally then use -g in npm install command.

Another way to do is that

1.Remove/Rename the node_modules folder of your project.

2.Change the dependencies in your package.json file to

 "dependencies": {
        "@angular/common": "4.1.3",
        "@angular/compiler": "4.1.3",
        "@angular/compiler-cli": "4.1.3",
        "@angular/core": "4.1.3",
        "@angular/forms": "4.1.3",
        "@angular/http": "4.1.3",
        "@angular/platform-browser": "4.1.3",
        "@angular/platform-browser-dynamic": "4.1.3",
        "@angular/tsc-wrapped": "^4.4.6",
        "rxjs": "5.4.0",
        "zone.js": "0.8.12"

3. Then run command 'npm install` in the folder where you have created your app.

ng new, Create a Feature Component · 4. Add Services · 5. Add In-app Navigation · 6. Get Data Creates and initializes a new Angular app that is the default project for a new workspace. Provides You can then use ng generate application to create an initial app. A collection of schematics to use in generating the initial app. If you want to create a Git repository for the newly generated Angular project but only would like to skip the initial commit you can also use flag --skip-commit instead. Conclusion. Creating new

You need to do following things to create an app with your choice:

Step 1. Set up the Development Environment:

You need to set up your development environment before you can do anything. Install Node.js and npm if they are not already on your machine.

Step 2: Then install the Angular CLI globally.

> npm install -g @angular/cli@1.4.*

Step 3: Create a new project

> ng new my-app

Step 4: Serve the application:

> cd my-app

> ng serve --open

The above app will be in angular 4.

Creating libraries, You can create and publish new libraries to extend Angular functionality. For more details on how a library project is structured you can refer the Library Include generation schematics in your library so that ng generate can scaffold your instead of peerDependencies , it might get a different Angular module instead,  go to your angular project folder and open the command promt an type "ng g component header" where header is the new component that you want to create.As default the header component will be created inside the app component.You can create components inside a component .For example if you want to create a component inside he header that we made above then type"ng g component header/menu".

Generating code using schematics, A schematic is a template-based code generator that supports complex logic. be a powerful tool for creating, modifying, and maintaining any software project, You can modify these schematics, and define new ones to do things like schematic (in place of a sub-command) to generate an artifact defined in your library. You can create and publish new libraries to extend Angular functionality. If you find that you need to solve the same problem in more than one app (or want to share your solution with other developers), you have a candidate for a library.

Setting up the local environment and workspace, You use the Angular CLI to create projects, generate application and library code​, and For more information about the Angular files generated by ng new , see  Create a Feature Component. Add In-app Navigation. Get Data from a Server. Creates a new workspace and an initial Angular app. Creates and initializes a new Angular app that is the default project for a new workspace. Provides interactive prompts for optional configuration, such as adding routing support. All prompts can safely be allowed to

Creating a Library in Angular 6 using Angular CLI and ng-packagr , When we use ng new , Angular CLI creates a new workspace for us. will also be a third project for End to End testing that Angular CLI generates for us Because of how the projects work in Angular 6, we need to create the  Angular is a platform for building mobile and desktop web applications. Join the community of millions of developers who build compelling user interfaces with Angular.

  • If you can you should use the latest version available it will save you the trouble of updating later