How to Create First Angular Project | How to create Angular Project in Visual Studio Code

Priti Jha
2 min readJan 16, 2024

--

Creating your first Angular project in Visual Studio Code involves a few steps. Angular CLI (Command Line Interface) makes it easy to scaffold and manage Angular projects. Here’s a step-by-step guide:

Prerequisites:

  1. Node.js and npm: Make sure you have Node.js installed on your machine, as Angular requires it. You can download it from nodejs.org.
  2. Angular CLI: Install Angular CLI globally using npm. Open your terminal or command prompt and run:
npm install -g @angular/cli

Steps to Create an Angular Project:

  1. Open Visual Studio Code: Open your Visual Studio Code editor.
  2. Create a new Angular project: In the terminal integrated into Visual Studio Code, run the following command to create a new Angular project:
ng new my-angular-app

(Replace "my-angular-app" with the name you want for your project.)

3. Navigate to the project folder: Change your working directory to the newly created project folder:

cd my-angular-app

4. Run the application: Use the following command to start the development server and open your app in a default web browser:

ng serve

This will compile your Angular application and serve it locally. You should see output indicating that the development server is running.

5. Open your app in a browser: Open your web browser and navigate to http://localhost:4200/. You should see your Angular app's default welcome page.

Additional Tips:

  • Code Editing: Open your project folder in Visual Studio Code and start editing the code. The src folder contains your application code, and you can explore and modify files as needed.
  • Generate Components, Modules, etc.: Angular CLI provides commands to easily generate components, services, modules, and more. For example, to generate a new component, run:
ng generate component my-component

This will create a new component with the specified name.

Congratulations! You’ve successfully created your first Angular project in Visual Studio Code. Feel free to explore the Angular documentation for more details and features: Angular Documentation.

--

--

Priti Jha

Senior front-end developer writing about Angular 8 , Ionic Framework ,Javascript, HTML, Css and all front end technology.