{ "id": "cli/new", "title": "ng new", "contents": "\n
\n
\n mode_edit\n code\n
\n \n\n\n
\n \n CLI\n
\n\n \n
\n

ng newlink

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

Creates a new workspace and an initial Angular application.

\n\n \nng new <name> [options]\n\nng n <name> [options]\n\n\n\n \n

\n \n Description\n

\n

Creates and initializes a new Angular application that is the default project for a new workspace.

\n

Provides interactive prompts for optional configuration, such as adding routing support.\nAll prompts can safely be allowed to default.

\n\n

If you plan to have multiple applications in the workspace, you can create an empty workspace by setting the --createApplication option to false.\nYou can then use ng generate application to create an initial application.\nThis allows a workspace name different from the initial app name, and ensures that all applications reside in the /projects subfolder, matching the structure of the configuration file.

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

Arguments

\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
ArgumentDescriptionValue Type
<name>\n

The name of the new workspace and initial project.

\n\n \n
string
\n\n\n \n\n

Options

\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
OptionDescriptionValue TypeDefault Value
\n --collection\n \n \n

A collection of schematics to use in generating the initial application.

\n\n

Aliases: -c

\n
string
\n --commit\n \n \n

Initial git repository commit information.

\n\n \n
booleantrue
\n --create-application\n \n \n

Create a new initial application project in the 'src' folder of the new workspace. When false, creates an empty workspace with no initial application. You can then use the generate application command so that all applications are created in the projects folder.

\n\n \n
booleantrue
\n --defaults\n \n \n

Disable interactive input prompts for options with a default.

\n\n \n
boolean
\n --directory\n \n \n

The directory name to create the workspace in.

\n\n \n
string
\n --dry-run\n \n \n

Run through and reports activity without writing out results.

\n\n

Aliases: -d

\n
booleanfalse
\n --force\n \n \n

Force overwriting of existing files.

\n\n

Aliases: -f

\n
booleanfalse
\n --help\n \n \n

Shows a help message for this command in the console.

\n\n \n
true|false|json|JSONfalse
\n --inline-style\n \n \n

Include styles inline in the component TS file. By default, an external styles file is created and referenced in the component TypeScript file.

\n\n

Aliases: -s

\n
boolean
\n --inline-template\n \n \n

Include template inline in the component TS file. By default, an external template file is created and referenced in the component TypeScript file.

\n\n

Aliases: -t

\n
boolean
\n --interactive\n \n \n

Enable interactive input prompts.

\n\n \n
boolean
\n --legacy-browsers\n \n \n \n

Deprecated: Legacy browsers support is deprecated since version 12. For more information, see https://angular.io/guide/browser-support

\n\n \n \n

Add support for legacy browsers like Internet Explorer using differential loading.

\n\n \n
booleanfalse
\n --minimal\n \n \n

Create a workspace without any testing frameworks. (Use for learning purposes only.)

\n\n \n
booleanfalse
\n --new-project-root\n \n \n

The path where new projects will be created, relative to the new workspace root.

\n\n \n
stringprojects
\n --package-manager\n \n \n

The package manager used to install dependencies.

\n\n \n
npm|yarn|pnpm|cnpm
\n --prefix\n \n \n

The prefix to apply to generated selectors for the initial project.

\n\n

Aliases: -p

\n
stringapp
\n --routing\n \n \n

Generate a routing module for the initial project.

\n\n \n
boolean
\n --skip-git\n \n \n

Do not initialize a git repository.

\n\n

Aliases: -g

\n
booleanfalse
\n --skip-install\n \n \n

Do not install dependency packages.

\n\n \n
booleanfalse
\n --skip-tests\n \n \n

Do not generate \"spec.ts\" test files for the new project.

\n\n

Aliases: -S

\n
booleanfalse
\n --strict\n \n \n

Creates a workspace with stricter type checking and stricter bundle budgets settings. This setting helps improve maintainability and catch bugs ahead of time. For more information, see https://angular.io/guide/strict-mode

\n\n \n
booleantrue
\n --style\n \n \n

The file extension or preprocessor to use for style files.

\n\n \n
css|scss|sass|less|styl
\n --verbose\n \n \n

Add more details to output logging.

\n\n

Aliases: -v

\n
booleanfalse
\n --view-encapsulation\n \n \n

The view encapsulation strategy to use in the initial project.

\n\n \n
Emulated|None|ShadowDom
\n\n\n \n
\n
\n\n\n" }