View All
View All
View All
View All
View All
View All
View All
View All
View All
View All
View All

How to Run an Angular Project: A Complete Step-by-Step Guide

By Rohan Vats

Updated on May 30, 2025 | 13 min read | 52.93K+ views

Share:

Did you know that about 0.3% of all websites with a known JavaScript library utilize Angular, totaling 1,267,356 live websites worldwide? This highlights Angular’s strong presence and its reliability in powering a substantial number of enterprise-scale web applications globally.

Successfully running an Angular project requires installing key software like Node.js and setting up the Angular CLI, which together enable you to create, build, and serve your application locally. These tools offer a streamlined development environment that simplifies managing and running Angular projects.

Angular is widely used to develop dynamic web applications like Netflix or Spotify, from single-page business apps to complex enterprise-level systems.

In this blog, you’ll discover simple steps to run your Angular project smoothly and confidently. Whether you’re new to Angular or seeking to revisit fundamental concepts, this guide will provide clear instructions to help you get started quickly and effectively.

Want to sharpen your Angular skills? Advance your tech career with upGrad’s Online Software Development Courses, featuring an updated curriculum on generative AI, industry-relevant projects, and hands-on case studies. Enroll now to stay ahead with the latest programming tools and languages.

What is Angular CLI?

Angular CLI, or Command Line Interface, is a powerful tool created to simplify and streamline the development process for Angular applications. This tool is known for its ease of use, and lets you focus on building your app, not on setup or repetitive tasks.

This is important while developing a web application, where efficiency and accuracy are critical. Angular CLI automates mundane tasks such as configuring files, creating boilerplate code, and managing dependencies. 

Take your Angular career to the next level! Check out upGrad’s Software and Tech Courses designed to equip you with industry-relevant skills and knowledge.

Now that you understand Angular CLI, let’s explore how to run an Angular project step by step.

Also Read: How to Install Angular CLI in Windows 10

5 Essential Steps to Successfully Run an Angular Project

Learning how to run an Angular project involves setting up a workspace, creating a starter app, serving it, and customizing its appearance. This guide provides a step-by-step approach to help you navigate the setup effortlessly, ensuring a smooth start to your Angular development journey.

Step 1: Create a Workspace and Starter App

Before running your Angular app, you need to create a workspace that will house your project files. Follow these steps:

1. Open Your Terminal

 Go to the directory where you want to create your project.

2. Run the Following Command

ng new my-angular-app 
  • ng new is an Angular CLI command that creates a new Angular workspace and a starter app.
  • my-angular-app is the name of your project folder.
  • During setup, the CLI asks:
    • Add Angular routing? — Choose “Yes” if you want navigation between pages.
    • Style format? — Choose CSS, SCSS, etc., for styling preferences.
  • This command generates the project structure, installs dependencies, and configures everything you need to start.

  3. Navigate to Your Project Directory

 Once the project is created, move into the project folder. 

You can use the following command:

cd my-angular-app

At this point, your workspace is ready, and a starter app with a default structure has been created.

Coverage of AWS, Microsoft Azure and GCP services

Certification8 Months

Job-Linked Program

Bootcamp36 Weeks

Upskill your web development expertise with upGrad's “Advanced JavaScript for All” course. Explore advanced concepts such as prototypes, scopes, classes, modules, and asynchronous programming through 25 hours of comprehensive learning. Strengthen your JavaScript skills and advance your journey to becoming a proficient developer today!

Also Read: How to Install Node.js and NPM on Windows? [Step-by-Step]

Step 2: Serve the Application

To preview your app in the browser, serve it using the Angular development server.

Follow these steps:

1. Run this command

ng serve
  • This compiles the app and starts a local development server.
  • By default, the app runs at http://localhost:4200.
  • Angular’s live reload feature automatically updates the browser to reflect any changes you make to your project files, allowing you to see updates instantly without manual refreshing.

Code Output: Open your browser and go to http://localhost:4200.

  • You’ll see the default Angular welcome page with a message like:
Welcome to my-angular-app!

2. Open Your Browser: Navigate to http://localhost:4200 to view your app. You should see a default Angular page with the message: "Welcome to my-angular-app!"

Enhance your front-end development skills by enrolling in the upGrad’s “React.js For Beginners” course. This beginner-friendly program provides a comprehensive introduction to building dynamic user interfaces and reusable components, skills that easily carry over to frameworks like Angular. Begin your journey towards becoming a proficient web developer today.

Step 3: Explore Component Files in the IDE 

Angular projects are built around modular components, each consisting of logic, template, and styling files. Understanding these core files helps you see how Angular organizes the app and displays content dynamically.

1. app.component.ts

This TypeScript file defines the root component’s behavior and links the template and styles to the component’s logic and data.

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',  // Custom tag in index.html where this component renders
  templateUrl: './app.component.html',  // Points to HTML template
  styleUrls: ['./app.component.css']    // Points to component CSS
})
export class AppComponent {
  title = 'my-angular-app';  // Data bound to the template
}

// No direct HTML output here; this file defines logic and data.

Code Explanation:

  • The @Component decorator marks this class as an Angular component.
  • selector tells Angular where to insert this component in HTML (<app-root>).
  • templateUrl and styleUrls link to the component’s HTML and CSS files.
  • The title property stores data displayed in the template.

This file itself doesn’t produce visible UI but provides the data (title) used in the HTML template.

2. app.component.html

The HTML template defines what the user sees on the page. It uses Angular’s interpolation to display dynamic data from the component class.

<h1>Welcome to {{ title }}!</h1>

Code Explanation:

  • This is the HTML template for the AppComponent.
  • {{ title }} is Angular’s interpolation syntax that inserts the title property’s value into the HTML.

Output:

When rendered, the application displays a large heading with the welcome message that includes the dynamic title “Welcome to my-angular-app!” This heading appears prominently on the web page, greeting users as they open the app.

Welcome to my-angular-app!

3. app.component.css

This CSS file styles the template elements specifically for this component, ensuring consistent and scoped styling.

h1 {
  color: #2c3e50;
  
}

/* Visual effect applied to the <h1> text in the rendered page */

Code Explanation:

  • This CSS file contains styles specific to the AppComponent.
  • It styles the <h1> element with:
    • A dark blue-gray text color (#2c3e50).
    • A clean, readable font stack starting with Arial.
  • Angular applies these styles only to this component by default, preventing style leakage to other parts of the app (component encapsulation).

Output:

The heading is styled according to the CSS rules, displaying the text “Welcome to my-angular-app!” in a dark blue-gray color using the Arial font, giving it a clean and professional appearance.

4. app.module.ts

This is the root Angular module, organizing components and dependencies and instructing Angular how to bootstrap the app.

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AppComponent } from './app.component';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
// No direct HTML output; sets up app module

Code Explanation:

  • Declares AppComponent as part of this module.
  • Imports necessary modules like BrowserModule.
  • Specifies AppComponent as the root component to launch.

This file configures the Angular application but does not produce any visible UI by itself. Instead, it enables the app to load properly and display the root component’s user interface.

5. main.ts

This is the application’s entry point that bootstraps the root module, effectively starting the Angular app.

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';

platformBrowserDynamic().bootstrapModule(AppModule)
  .catch(err => console.error(err));

Code Explanation:

  • Dynamically bootstraps the Angular app using the AppModule.
  • Handles any errors during startup.

This process results in the root component (AppComponent) rendering the UI in the browser.

Output:

Welcome to my-angular-app!

(The Angular app loads and displays this as the main page content.)

Curious to enhance your tech skills? Join upGrad’s Full Stack Development Course by IIITB, where you’ll learn from top industry experts and gain the essential skills to succeed in the field of full stack development. Enroll now and take the first step toward a rewarding career in tech!

Also Read: Web Application Architecture: Function, Components, Types & Real Life Examples

Step 4: Add a Title to the App

Now time to make a small change to your app by updating the title.

1. Modify the Title

Open app.component.html and replace the default content with:

<h1>Welcome to My First Angular Project!</h1>

2. Save the File

As soon as you save the file, the browser will reload automatically, and you’ll see the updated title.

3. Understand the Impact

This change shows how Angular’s component-based architecture allows you to update specific parts of your app easily.

Ready to advance your Angular Development skills with AI? Enroll in the upGrad’s Generative AI Foundations Certificate Program to gain expertise in 15 top AI tools, including Microsoft Copilot, Azure AI, and GitHub. Gain practical skills that you can apply immediately and earn a joint completion certification from upGrad and Microsoft. Get started today!

Step 5: Style the Application

Add some custom styling to make your app visually appealing. You can follow the below steps:

1. Open the CSS File:
Navigate to app.component.css and add the following styles:

h1 {  
  color: #1976d2;
  
  text-align: center;  
  margin-top: 20px;  
}

Code Explanation:

  • color: #1976d2; sets the heading text color to a bright blue shade.
  • applies Arial font or a similar sans-serif font for clear, modern text appearance.
  • text-align: center; centers the heading horizontally within its container.
  • margin-top: 20px; adds space above the heading to separate it visually from elements above.

Output:

The heading text (<h1>) is displayed in a vibrant blue color (#1976d2) and is horizontally centered using Arial font styling. Furthermore, the application of a top margin provides adequate spacing above the heading, enhancing its prominence and contributing to an improved overall layout.

2. Save and Refresh:
The browser will reload automatically, displaying your newly styled header.

3. Experiment with Styles:
Add more styles to customize other parts of the app, experimenting with Angular’s modular CSS approach.

For example, if you want to build and run a simple Angular app to display a welcome message, you can follow these steps using the above workflow:

  • Create the app using ng new.
  • Serve the app with ng serve.
  • Modify the app.component.html to include a personalized welcome message.
  • Style it using app.component.css.

By following these steps, you’ll not only run your Angular project but also understand how to modify and personalize it effectively. These fundamentals are key to building dynamic, interactive web applications.

What are the Prerequisites for Running an Angular Project?

To get started, there are a few core development technologies you need to work with Angular:

  • JavaScript: Angular is a JavaScript framework. Understanding JavaScript is crucial for implementing logic, handling events, and interfacing with APIs within your Angular project.
  • HTML: Angular templates are built using HTML. You’ll use it to define your app’s structure and user interface.
  • CSS: CSS is used to style your Angular components, making the app visually appealing and responsive.
  • TypeScript: Angular is built with TypeScript, so familiarity with TypeScript (a superset of JavaScript) is highly recommended.
  • Node.js and Node Package Manager (npm): Required to install Angular CLI and manage dependencies.
  • Angular CLI: A command-line tool that helps create, build, and serve Angular projects efficiently.

Curious to know how to become an Angular Developer and build dynamic, responsive web applications? Begin with upGrad's JavaScript Basics from Scratch Course. You'll lay a strong base in key concepts like variables, data types and functions. Enroll now and acquire the core skills every aspiring developer needs to succeed!

Here’s a detailed list of software tools you need to install before starting an Angular project:

1. Node.js and npm (Node Package Manager)

  • Purpose: Node.js provides a JavaScript runtime environment outside the browser, enabling development tools and build processes. npm manages project dependencies, including Angular packages and third-party libraries.
  • Requirement: Use the latest LTS (Long-Term Support) version of Node.js to ensure stability and compatibility.
  • Example Usage: Installing Angular CLI globally, managing packages via package.json, running build scripts.
  • Installation: Download from the official website:  Download Node.js
Note: npm comes bundled with Node.js. You can verify installation and versions by running node -v and npm -v in your terminal.

Want to level up your Angular Development skills? upGrad’s Generative AI Mastery Certificate for Software Development is designed to help you integrate generative AI into your projects, making your applications smarter and more efficient. With hands-on projects and Microsoft certification, this course equips you with advanced skills to stay competitive in the AI-driven future of development.

2. Angular CLI (Command Line Interface)

  • Purpose: Angular CLI automates project scaffolding, builds, testing, linting, and deployment tasks, streamlining development workflows.
  • Installation Command:
npm install -g @angular/cli

Angular CLI supports commands such as ng new (creates new projects), ng serve (runs a development server with live reload), and ng build (compiles the app for production). CLI also integrates with testing frameworks and supports schematic plugins for generating components, services, etc.

3. Code Editor (e.g., Visual Studio Code)

  • Purpose: Code editors provide an environment to write, navigate, and debug code efficiently.
  • Recommendation: Visual Studio Code (VS Code) is the most popular editor for Angular due to its lightweight nature, integrated terminal, debugging support, and extensive extensions (like Angular Language Service, Prettier, ESLint).
Note: Configure VS Code with Angular-specific extensions to improve code completion, error detection, and template highlighting.

4. Browser (e.g., Chrome):

  • Purpose: To run and debug Angular applications during development and testing.
  • Recommendation: Google Chrome is preferred for its robust developer tools, including Angular DevTools, which provide detailed insight into component trees, change detection cycles, and performance profiling.
  • Additional Tools: Consider installing the Angular DevTools Chrome extension for enhanced debugging capabilities.

Also Read: Creating Libraries: How to Build a Library for Angular Apps?

Angular works seamlessly on various operating systems. Here’s an overview:

 

Operating System

Compatibility

Windows Windows 8.1 or later, including Windows 11
macOS macOS 10.15 (Catalina) or later
Linux Most major distributions supported

Make sure your OS is updated to the latest version to avoid compatibility issues.

Optional but Recommended Tools

  • Git: Version control system to manage source code changes and collaborate efficiently.
  • Package Managers Alternatives: Yarn can be used as an alternative to npm for faster dependency management.
  • Docker: For containerizing your Angular app and creating reproducible development environments.
  • Postman or similar tools: For testing RESTful APIs endpoints that your Angular app might consume for data operations like GET, POST, PUT, and DELETE.

You’ll also need a stable internet connection to:

  • Download Node.js, Angular CLI, and other libraries.
  • Install dependencies for your project using npm.
  • Access online documentation or resources during development.

By ensuring these prerequisites are met, you’ll have a smooth experience starting and running your Angular project. These tools and technologies are the backbone of Angular development, so take the time to get them right before diving into coding!

Transform your design career with upGrad’s Master of Design in User Experience Course, focused on building seamless, user-centric web apps. Learn from design leaders at Apple, Pinterest, Cisco, and PayPal. Enroll now to create world-class Angular products that stand out!

Level up your Angular skills with upGrad!

To run an Angular project, you need to set up the environment by installing necessary tools like Node.js, and use Angular CLI commands to build and serve your application. Following these steps ensures a smooth development experience and helps you bring your app to life efficiently. However, developing proficiency in these skills and staying updated with the latest industry practices requires continuous learning and guidance.

upGrad offers comprehensive courses that enhance your understanding of Angular and modern web development. With industry-relevant curriculum and expert guidance, upGrad equips you with the skills needed to excel in your tech career and stay ahead in a competitive market.

Here are a few additional courses recommended to complement your learning journey. While they are not directly linked to Angular, they can help you broaden your skills in related areas.

Curious about which software development course best fits your goals in 2025? Contact upGrad for personalized counseling and valuable insights, or visit your nearest upGrad offline center for more details.

Boost your career with our popular Software Engineering courses, offering hands-on training and expert guidance to turn you into a skilled software developer.

Master in-demand Software Development skills like coding, system design, DevOps, and agile methodologies to excel in today’s competitive tech industry.

Stay informed with our widely-read Software Development articles, covering everything from coding techniques to the latest advancements in software engineering.

References:
https://www.esparkinfo.com/software-development/technologies/angular/statistics

Frequently Asked Questions (FAQs)

1. How do I set up my environment to run an Angular project?

2. What is the exact command to create a new Angular project and how does it work?

3. How can I run my Angular project locally to test changes?

4. Why do I sometimes get errors related to missing dependencies when running ng serve?

5. How can I run my Angular project in production mode locally?

6. What is the role of Angular CLI during the project run process?

7. How do I troubleshoot Angular CLI errors during ng serve or ng build?

8. How can I run multiple Angular projects at the same time on my machine without conflicts?

9. How do environment configurations affect running Angular projects?

10. How do I deploy my locally running Angular project after building it?

11. How do I handle CORS issues when running an Angular app that consumes APIs during development?

Rohan Vats

408 articles published

Software Engineering Manager @ upGrad. Passionate about building large scale web apps with delightful experiences. In pursuit of transforming engineers into leaders.

Get Free Consultation

+91

By submitting, I accept the T&C and
Privacy Policy

India’s #1 Tech University

Executive PG Certification in AI-Powered Full Stack Development

77%

seats filled

View Program

Top Resources

Recommended Programs

upGrad

AWS | upGrad KnowledgeHut

AWS Certified Solutions Architect - Associate Training (SAA-C03)

69 Cloud Lab Simulations

Certification

32-Hr Training by Dustin Brimberry

upGrad

Microsoft | upGrad KnowledgeHut

Microsoft Azure Data Engineering Certification

Access Digital Learning Library

Certification

45 Hrs Live Expert-Led Training

upGrad

upGrad KnowledgeHut

Professional Certificate Program in UI/UX Design & Design Thinking

#1 Course for UI/UX Designers

Bootcamp

3 Months