How to create a new angular project

To create a new Angular project, you can use the Angular CLI (Command-Line Interface). Here are the steps:

Prerequisites:

Create a new Angular project:

  1. Open a terminal or command prompt.

  2. Run the following command to create a new Angular project:

    ng new my-app

    Replace my-app with the name of your project.

  3. The Angular CLI will ask you a few questions:

    • Would you like to add Angular routing? (y/n) - press Enter to accept the default (y)
    • Which stylesheet format would you like to use? (CSS, SCSS, Sass, Less) - choose one (e.g., CSS)
  4. The Angular CLI will create a new directory with the name you specified, and initialize a new Angular project.

Explore your new project:

  1. Navigate to the project directory:

    cd my-app
  2. Run ng serve to start the development server:

    ng serve

    This will start the development server and open your project in your default web browser.

  3. You can now explore your project structure and files:

    • src/ directory contains the source code for your application
    • app/ directory contains the main application component and other components
    • styles.css is the main stylesheet for your application
    • main.ts is the entry point for your application

Next steps:

  1. Start building your application by creating new components, services, and other features.
  2. Run ng serve to see your changes in action.
  3. Use the Angular CLI to generate new components, services, and other features using the ng generate command.

That's it! You now have a brand new Angular project up and running.