ng new
ng new [name] [--[argument]=[value]]
ng n
Creates a new angular application.
Creates and initializes a new Angular app that is the default project for a new workspace.
Provides interactive prompts for optional configuration, such as adding routing support. All prompts can safely be allowed to default.
The new workspace folder is given the specified project name, and contains configuration files at the top level.
By default, the files for a new initial app (with the same name as the workspace) are placed in the
src/
subfolder. Corresponding end-to-end tests are placed in thee2e/
subfolder.The new app's configuration appears in the
projects
section of theangular.json
workspace configuration file, under its project name.Subsequent apps that you generate in the workspace reside in the
projects/
subfolder.
If you plan to have multiple apps in the workspace, you can create an empty workspace by setting the --createApplication
option to false.
You can then use ng generate application
to create an initial app.
This allows a workspace name different from the initial app name, and ensures that all apps reside in the /projects
subfolder, matching the structure of the configuration file.
Options
--collection
#
Type | string |
Default | @schematics/angular |
Aliases | c |
--commit
#
Type | boolean |
Default | true |
--createApplication
#
Type | boolean |
Default | true |
--defaults
#
Type | boolean |
Default | false |
--directory
#
Type | string |
--dryRun
#
Type | boolean |
Default | false |
Aliases | d |
--force
#
Type | boolean |
Default | false |
Aliases | f |
--help
#
Values | true|false|json|JSON |
Default | false |
--inlineStyle
#
Type | boolean |
Default | false |
Aliases | s |
--inlineTemplate
#
Type | boolean |
Default | false |
Aliases | t |
--interactive
#
Type | boolean |
Default | false |
--minimal
#
Type | boolean |
Default | false |
--newProjectRoot
#
Type | string |
Default | projects |
--packageManager
#
Type | string |
Values | npm|yarn|pnpm|cnpm |
--prefix
#
Type | string |
Default | app |
Aliases | p |
--routing
#
Type | boolean |
Default | false |
--skipGit
#
Type | boolean |
Default | false |
Aliases | g |
--skipPackageJson
#
Aliases | skip-package-json |
--skipInstall
#
Type | boolean |
Default | false |
--skipTests
#
Type | boolean |
Default | false |
Aliases | S |
--strict
#
Type | boolean |
Default | false |
--style
#
Type | string |
Values | css, scss, less, sass, styl |
Default | css |
--verbose
#
Type | boolean |
Default | false |
Aliases | v |
--viewEncapsulation
#
Values | Emulated|Native|None|ShadowDom |
Aliases | view-encapsulation |