Angular cli create new project
To create a new Angular project using the Angular CLI, follow these steps:
Step 1: Install the Angular CLI
If you haven't already, install the Angular CLI globally on your system using npm or yarn:
npm install -g @angular/cli
or
yarn global add @angular/cli
Step 2: Create a new project
Open a terminal or command prompt and navigate to the directory where you want to create your new project. Then, run the following command:
ng new my-new-project
Replace my-new-project
with the name of your project.
Step 3: Choose the project template
The Angular CLI will prompt you to choose a project template. You can choose from the following options:
blank
: A blank project with no features enabled.routing
: A project with routing enabled.service-worker
: A project with a service worker enabled.e2e
: A project with end-to-end tests enabled.
Choose the template that best fits your needs, and press Enter.
Step 4: Configure the project
The Angular CLI will ask you to configure your project. You'll be prompted to choose the following:
- Language: Choose the language you want to use for your project (e.g., TypeScript, JavaScript).
- CSS: Choose the CSS preprocessor you want to use (e.g., Sass, Less).
- Unit testing: Choose whether you want to use Jest or Karma for unit testing.
- E2E testing: Choose whether you want to use Cypress or Protractor for end-to-end testing.
Choose your options and press Enter.
Step 5: Create the project
The Angular CLI will create your new project and install the necessary dependencies. This may take a few minutes.
Step 6: Start the project
Once the project is created, navigate to the project directory and start the development server using the following command:
ng serve
This will start the development server and open your project in your default web browser.
That's it! You now have a new Angular project created using the Angular CLI.