How to create 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)
    • Which stylesheet format would you like to use? (CSS, SCSS, or Sass)
    • Would you like to add a unit testing library? (Jest or None)
  4. Answer the questions and press Enter to create the project.

Project structure:

The Angular CLI will create a new project with the following structure:

my-app/
app/
app.component.ts
app.component.html
app.component.css
app.module.ts
...
node_modules/
...
package.json

The app folder contains the main application code, while node_modules contains the dependencies installed by npm. package.json is the project configuration file.

Start the development server:

  1. Navigate to the project directory:
    cd my-app
  2. Run the following command to start the development server:
    ng serve

    This will start the Angular development server, which will serve your application at http://localhost:4200.

Open the application in a browser:

  1. Open a web browser and navigate to http://localhost:4200.
  2. You should see the default Angular application page.

That's it! You now have a new Angular project up and running. You can start building your application by modifying the code in the app folder.