new
ng new
ng n
Creates and initializes a new Angular application 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 application (with the same name as the workspace) are placed in the
src/
subfolder.The new application's configuration appears in the
projects
section of theangular.json
workspace configuration file, under its project name.Subsequent applications that you generate in the workspace reside in the
projects/
subfolder.
If you plan to have multiple applications in the workspace, you can create an empty workspace by using the --no-create-application
option.
You can then use ng generate application
to create an initial application.
This 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.
Arguments
name
The name for the new workspace and the initial project. This name will be used for the root directory and various identifiers throughout the project.
string
Options
collection
c
A collection of schematics to use in generating the initial application.
string
commit
Configure the initial Git commit for the new repository.
boolean
Defaulttrue
create-application
Create a new initial application project in the new workspace. When false, creates an empty workspace with no initial application. You can then use the ng generate application
command to create applications in the projects
directory.
boolean
Defaulttrue
defaults
Disable interactive input prompts for options with a default.
boolean
Defaultfalse
directory
The directory where the new workspace and project should be created. If not specified, the workspace will be created in the current directory.
string
dry-run
d
Run through and reports activity without writing out results.
boolean
Defaultfalse
experimental-zoneless
Create an initial application that does not utilize zone.js
.
boolean
Defaultfalse
force
Force overwriting of existing files.
boolean
Defaultfalse
help
Shows a help message for this command in the console.
boolean
inline-style
s
Include the styles for the initial application's root component directly within the app.component.ts
file. By default, a separate stylesheet file (e.g., app.component.css
) is created.
boolean
inline-template
t
Include the HTML template for the initial application's root component directly within the app.component.ts
file. By default, a separate template file (e.g., app.component.html
) is created.
boolean
interactive
Enable interactive input prompts.
boolean
Defaulttrue
minimal
Generate a minimal Angular workspace without any testing frameworks. This is intended for learning purposes and simple experimentation, not for production applications.
boolean
Defaultfalse
new-project-root
The path where new projects will be created within the workspace, relative to the workspace root. By default, new projects are created in the projects
directory.
string
Defaultprojects
package-manager
The package manager used to install dependencies.
string
prefix
p
The prefix to apply to generated selectors for the initial project. For example, if the prefix is my-app
and you generate a component named my-component
, the selector will be my-app-my-component
.
string
Defaultapp
routing
Enable routing in the initial application project. This sets up the necessary files and modules for managing navigation between different views in your application.
boolean
server-routing
Create a server application in the initial project using the Server Routing and App Engine APIs (Developer Preview).
boolean
skip-git
g
Do not initialize a Git repository in the new workspace. By default, a Git repository is initialized to help you track changes to your project.
boolean
Defaultfalse
skip-install
Skip the automatic installation of packages. You will need to manually install the dependencies later.
boolean
Defaultfalse
skip-tests
S
Skip the generation of unit test files spec.ts
.
boolean
Defaultfalse
ssr
Configure the initial application for Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering).
boolean
standalone
Creates an application based upon the standalone API, without NgModules.
boolean
Defaulttrue
strict
Enable 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.dev/tools/cli/template-typecheck#strict-mode
boolean
Defaulttrue
style
The type of stylesheet files to be created for components in the initial project.
string
view-encapsulation
Sets the view encapsulation mode for components in the initial project. This determines how component styles are scoped and applied. Options include: Emulated
(default, styles are scoped to the component), None
(styles are global), and ShadowDom
(styles are encapsulated using Shadow DOM).
string