Angular new project
Here are the steps to create a new Angular project:
Using the Angular CLI
-
Install the Angular CLI globally by running the following command:
npm install -g @angular/cli
-
Create a new Angular project by running the following command:
ng new my-app
Replace
my-app
with the name of your project. -
Follow the prompts to choose the project template and configuration options.
Using the Angular CLI with a specific template
If you want to create a project with a specific template, you can use the following command:
ng new my-app --template [template-name]
Replace my-app
with the name of your project and [template-name]
with the name of the template you want to use (e.g. blank
, routing
, service-worker
, etc.).
Using the Angular CLI with a specific configuration
If you want to create a project with a specific configuration, you can use the following command:
ng new my-app --configuration [configuration-name]
Replace my-app
with the name of your project and [configuration-name]
with the name of the configuration you want to use (e.g. es5
, es6
, es7
, etc.).
Using the Angular CLI with a specific version
If you want to create a project with a specific version of Angular, you can use the following command:
ng new my-app --version [version]
Replace my-app
with the name of your project and [version]
with the version of Angular you want to use (e.g. 12.0.0
, 11.2.14
, etc.).
Using the Angular CLI with a specific package manager
If you want to create a project with a specific package manager, you can use the following command:
ng new my-app --package-manager [package-manager]
Replace my-app
with the name of your project and [package-manager]
with the name of the package manager you want to use (e.g. npm
, yarn
, etc.).
Once you've created your project, you can navigate to the project directory and start building your Angular application.
Here are some common commands you can use to get started:
ng serve
: Start the development server and open the application in your default browser.ng build
: Build the application for production.ng test
: Run the unit tests for the application.ng e2e
: Run the end-to-end tests for the application.