- Angular CLI - Code Coverage
- Angular CLI - ng xi18n
- Angular CLI - ng update
- Angular CLI - ng doc
- Angular CLI - ng config
- Angular CLI - ng analytics
- Angular CLI - ng add
- Angular CLI - ng e2e
- Angular CLI - ng test
- Angular CLI - ng lint
- Angular CLI - ng serve
- Angular CLI - ng run
- Angular CLI - ng build
- Angular CLI - ng generate
- Angular CLI - ng help
- Angular CLI - ng new
- Angular CLI - ng version
- Angular CLI - Environment Setup
- Angular CLI - Overview
- Angular CLI - Home
Angular CLI Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Angular CLI - ng new Command
This chapter explains the syntax, argument and options of ng new command along with an example.
Syntax
The syntax for ng new command is as follows −
ng new <name> [options] ng n <name> [options]
ng new command creates a workspace of given name with a default Angular Apppcation.
It provides interactive prompts to set optional configurations. All prompts have default values to choose.
Argument
The argument for ng new command is as follows −
Sr.No. | Argument & Syntax | Description |
---|---|---|
1 | <name> | The name of the new workspace and initial project. |
Sr.No. | Option & Syntax | Description |
---|---|---|
1 | --collection=collection | A collection of schematics to use in generating the initial app. Apases: -c. |
2 | --commit=true|false | Initial git repository commit information. Default: true. |
3 | --createApppcation=true|false | When true (the default), creates a new initial app project in the src folder of the new workspace. When false, creates an empty workspace with no initial app. You can then use to generate apppcation command so that all apps are created in the projects folder. Default: true. |
4 | -defaults=true|false | When true, disables interactive input prompts for options with a default. |
5 | --directory=directory | The directory name to create the workspace in. |
6 | --dryRun=true|false | When true, runs through and reports activity without writing out results. Default: false. Apases: -d. |
7 | --force=true|false | When true, forces overwriting of existing files. Default: false. Apases: -f. |
8 | --help=true|false|json|JSON | Shows a help message for this command in the console. Default: false. |
9 | --inpneStyle=true|false | When true, includes styles inpne in the component TS file. By default, an external styles file is created and referenced in the component TS file. Default: false. |
10 | --inpneStyle=true|false | When true, includes styles inpne in the componentTS file. By default, an external styles file is created and referenced in the component TS file. Default: false. Apases: -t. |
11 | --interactive=true|false | When true, creates a project without any testing frameworks. (Use for learning purposes only.) Default: false. |
12 | --newProjectRoot=newProjectRoot | The path where new projects will be created, relative to the new workspace root. Default: projects. |
13 | --packageManager=npm|yarn|pnpm|cnpm | The package manager used to install dependencies. |
14 | --prefix=prefix | The prefix to apply to generated selectors for the initial project. Default: app. Apases: -p. |
15 | --prefix=prefix | The prefix to apply to generated selectors for the initial project. Default: app. Apases: -p. |
16 | --routing=true|false | When true, generates a routing module for the initial project. |
17 | --skipGit=true|false | When true, does not initiapze a git repository. Default: false. Apases: -g. |
18 | --skipInstall=true|false | When true, does not install dependency packages. Default: false. |
19 | --skipTests=true|false | When true, does not generate "spec.ts" test files for the new project. Default: false. Apases: -S. |
20 | --strict=true|false | Creates a workspace with stricter TypeScript compiler options. Default: false. |
21 | --style=css|scss|sass|less|styl | The file extension or preprocessor to use for style files. |
22 | --verbose=true|false | When true, adds more details to output logging. Default: false. Apases: -v. |
23 | -- viewEncapsulation=Emulated|Native|None|ShadowDom | The view encapsulation strategy to use in the initial project. |