Setting up the local environment and workspace - Angular
Last Updated :
06 May, 2024
Angular is a popular open-source web application framework developed and maintained by Google. It is primarily used for building single-page applications (SPAs) and provides a structured approach to developing complex web applications. Setting up the local environment and workspace is a crucial step before starting any Angular project.
Prerequisites:
Before you begin, ensure that you have the following software installed on your machine:
- Node.js: Angular requires Node.js and its package manager, npm (Node Package Manager), to be installed. You can download the latest version of Node.js from the official website: https://nodejs.org/
- Editor or IDE: You'll need a code editor or an Integrated Development Environment (IDE) to write and edit your Angular code. Popular choices include Visual Studio Code, WebStorm, Atom, and Sublime Text.
Features of Angular
The Angular CLI provides several features to streamline the development process, including:
- Generating boilerplate code for components, services, and other Angular constructs
- Serving the application during development with live reloading
- Building the application for production with ahead-of-time (AOT) compilation and bundling
- Running unit tests and end-to-end tests
- Adding third-party libraries and packages
Let's setup an angular app
Follow below steps to create a new Angular application using the Angular CLI:
1. Install the Angular CLI globally: Open your terminal or command prompt and run the following command to install the Angular CLI globally:
npm install -g @angular/cli
2. Create a new Angular project: Navigate to the desired location for your project and run the following command to create a new Angular project:
ng new my-app
This command will prompt you with several options. You can accept the defaults or customize them according to your preferences.
3. Navigate to the project directory: After the project is created, navigate to the project directory
cd my-app
Folder Structure:

Dependencies:
"dependencies": {
"@angular/animations": "^17.3.0",
"@angular/common": "^17.3.0",
"@angular/compiler": "^17.3.0",
"@angular/core": "^17.3.0",
"@angular/forms": "^17.3.0",
"@angular/platform-browser": "^17.3.0",
"@angular/platform-browser-dynamic": "^17.3.0",
"@angular/router": "^17.3.0",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.14.3"
}
4. Run the development server: Start the development server by running the following command:
ng serve --open
This command will compile your Angular application and start a local development server. You should see an output similar to the following:

5. Build the project for production: To build your Angular project for production, run the following command
ng build --configuration=production
This command will optimize and bundle your application for production deployment. The built files will be placed in the dist/ directory.
By following these steps, you have successfully set up the local environment and workspace for your Angular project. You can now start developing and building your Angular applications.
Similar Reads
Local Environment Setup in Angular
Setting up a local environment for Angular development is the first step to building powerful, scalable web applications. This guide will walk you through the entire process, from installing the necessary tools to creating and running your first Angular project. PrerequisitesNode.js npmSteps to Setu
2 min read
Generate an angular@16 project within nx workspace
Nx Workspace is a powerful tool that provides monorepo-style development for Angular projects. It offers enhanced capabilities for managing multiple applications, libraries, and shared code within a single workspace. In this article we will see how to generate an Angular 16 project withing NX worksp
2 min read
How To Configure And Use Environment Variables in NestJS?
Environment variables are an important part of application development, allowing developers to configure applications in different environments (development, staging, production) without hardcoding sensitive or environment-specific information into the application code. In this article, we'll walk t
2 min read
Creating and managing workspaces in Postman
A workspace in Postman is a shared environment where team members can collaborate on API development. It serves as a centralized hub for storing API requests, collections, environments, and other resources related to API development. Table of Content Steps to access Posstman WorkspacesGetting the wo
15+ min read
Difference Between Template And TemplateUrl In Angular
Occasionally, you may want to define a component's template in Angular to control how it appears and functions. Angular offers two methods to add a template to a component: template and templateUrl. Despite having a similar appearance, they have diverse functions. When using Angular, the @Component
5 min read
The Future of Angular JS in 2025 [Top Trends and Predictions]
Web development is a fast-paced and dynamic field that requires constant learning and adaptation. As web developers, we need to keep up with the latest trends and technologies that shape the future of the web. One of the most popular and influential technologies in web development is Angular JS, a J
12 min read
Setting up i18n in Angular 17 for Multi-Language Support
Think of your web app as a tool that can connect with users worldwide. To ensure a welcoming and user-friendly experience for everyone, we need to speak their language. Internationalization (i18n) is the process of making your app adaptable to multiple languages and regions. Angular provides powerfu
5 min read
What is router-outlet in Angular, and where is it used?
In Angular, a router-outlet is a directive that acts as a placeholder in a component's template. It's used to dynamically load different components based on the current URL route. Router-outlet is a crucial part of Angular's routing system, enabling you to build single-page applications where differ
5 min read
Introduction to Angular Service Worker
A Service Worker is a script that acts as the proxy to the browser network, to enable offline or low connectivity applications. The service worker is available in the form of the @angular/service-worker package that allows to easily integrate service workers into the Angular application. The Angular
5 min read
Environment Variables are Undefined in Next.js App
Environment variables play a crucial role in web development, especially in configuring sensitive information such as API keys, database URLs, and other configuration settings. If your environment variables are showing up as undefined in your Next.js app, it can disrupt functionality. This issue typ
3 min read