{ "id": "guide/setup-local", "title": "Setting up the local environment and workspace", "contents": "\n\n\n
\n mode_edit\n
\n\n\n
\n

Setting up the local environment and workspacelink

\n

This guide explains how to set up your environment for Angular development using the Angular CLI tool.\nIt includes information about prerequisites, installing the CLI, creating an initial workspace and starter app, and running that app locally to verify your setup.

\n
\n
Try Angular without local setup
\n

If you are new to Angular, you might want to start with Try it now!, which introduces the essentials of Angular in the context of a ready-made basic online store app that you can examine and modify. This standalone tutorial takes advantage of the interactive StackBlitz environment for online development. You don't need to set up your local environment until you're ready.

\n
\n\n\n

Prerequisiteslink

\n

To use the Angular framework, you should be familiar with the following:

\n\n

Knowledge of TypeScript is helpful, but not required.

\n

To install Angular on your local system, you need the following:

\n\n\n\n\n\n

Install the Angular CLIlink

\n

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.

\n

To install the Angular CLI, open a terminal window and run the following command:

\n\n npm install -g @angular/cli\n\n\n

Create a workspace and initial applicationlink

\n

You develop apps in the context of an Angular workspace.

\n

To create a new workspace and initial starter app:

\n
    \n
  1. \n

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

    \n\n ng new my-app\n\n\n
  2. \n
  3. \n

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

    \n
  4. \n
\n

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

\n

The CLI creates a new workspace and a simple Welcome app, ready to run.

\n
\n

You also have the option to use Angular's strict mode, which can help you write better, more maintainable code.\nFor more information, see Strict mode.

\n
\n\n

Run the applicationlink

\n

The Angular CLI includes a server, so that you can build and serve your app locally.

\n
    \n
  1. \n

    Navigate to the workspace folder, such as my-app.

    \n
  2. \n
  3. \n

    Run the following command:

    \n
  4. \n
\n\n cd my-app\n ng serve --open\n\n

The ng serve command launches the server, watches your files,\nand rebuilds the app as you make changes to those files.

\n

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

\n

If your installation and setup was successful, you should see a page similar to the following.

\n
\n \"Welcome\n
\n

Next stepslink

\n\n\n \n
\n\n\n" }