Generate new angular project
Here are the steps to generate a new Angular project:
Using the Angular CLI
- Open a terminal or command prompt.
- Install the Angular CLI if you haven't already:
npm install -g @angular/cli
- Run the following command to create a new Angular project:
ng new my-new-project
(replace "my-new-project" with your desired project name) - Follow the prompts to choose the project template and configuration options.
Using the Angular CLI with a specific template
- Open a terminal or command prompt.
- Install the Angular CLI if you haven't already:
npm install -g @angular/cli
- Run the following command to create a new Angular project with a specific template:
ng new my-new-project --template full
(replace "my-new-project" with your desired project name and "full" with the template name you want to use)
Available templates:
full
: A full-featured Angular project with routing, services, and a basic layout.minimal
: A minimal Angular project with only the essentials.routing
: An Angular project with routing enabled.service-worker
: An Angular project with a service worker enabled.
Using a different version of Angular
- Open a terminal or command prompt.
- Install the Angular CLI if you haven't already:
npm install -g @angular/cli
- Run the following command to create a new Angular project with a specific version:
ng new my-new-project --version 12.2.0
(replace "my-new-project" with your desired project name and "12.2.0" with the version of Angular you want to use)
Available versions:
12.2.0
: The latest version of Angular.11.2.0
: The previous version of Angular.10.2.0
: The version of Angular before that.
After running the command, the Angular CLI will create a new project with the specified template and configuration options. You can then navigate to the project directory and start building your Angular application.