0% found this document useful (0 votes)
92 views

Angular: Step 1: Install The Angular CLI

The document outlines the steps to create an Angular application: 1. Install the Angular CLI globally using npm to create projects and manage development tasks. 2. Create a new workspace and initial app project called "my-app" using the ng new command which sets up the necessary files and dependencies. 3. Serve the application locally using the ng serve command which launches a development server, rebuilds the app on changes, and opens the app in the browser.

Uploaded by

samke
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
92 views

Angular: Step 1: Install The Angular CLI

The document outlines the steps to create an Angular application: 1. Install the Angular CLI globally using npm to create projects and manage development tasks. 2. Create a new workspace and initial app project called "my-app" using the ng new command which sets up the necessary files and dependencies. 3. Serve the application locally using the ng serve command which launches a development server, rebuilds the app on changes, and opens the app in the browser.

Uploaded by

samke
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Angular

Step 1: Install the Angular CLI


You use the Angular CLI to create projects, generate application and library code, and perform
a variety of ongoing development tasks such as testing, bundling, and deployment.

Install the Angular CLI globally.

To install the CLI using npm , open a terminal/console window and enter the following command:

npm install -g @angular/cli

Step 2: Create a workspace and initial application


You develop apps in the context of an Angular workspace. A workspace contains the files for
one or more projects. A project is the set of files that comprise an app, a library, or end-to-end
(e2e) tests.

To create a new workspace and initial app project:


1. Run the CLI command ng new and provide the name my-app , as shown here:

ng new my-app
2. The ng new command prompts you for information about features to include in the initial
app project. Accept the defaults by pressing the Enter or Return key.

The Angular CLI installs the necessary Angular npm packages and other dependencies. This
can take a few minutes.

It also creates the following workspace and starter project files:

 A new workspace, with a root folder named my-app


 An initial skeleton app project, also called my-app (in the src subfolder)
 An end-to-end test project (in the e2e subfolder)
 Related configuration files

The initial app project contains a simple Welcome app, ready to run.

Step 3: Serve the application


Angular includes a server, so that you can easily build and serve your app locally.
1. Go to the workspace folder ( my-app).
2. Launch the server by using the CLI command ng serve, with the --open option.

cd my-app
ng serve --open
The ng serve command launches the server, watches your files, and rebuilds the app as you
make changes to those files.

The --open (or just -o) option automatically opens your browser to http://localhost:4200/ .

Your app greets you with a message:

You might also like