Angular CLI - ng new Command

This chapter explains the syntax, argument and options of ng new command along with an example.
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 Application.
It provides interactive prompts to set optional configurations. All prompts have default values to choose.
The argument for ng new command is as follows −
Options are optional parameters.
A collection of schematics
to use in generating the
initial app.
Aliases: -c.
Initial git repository commit information.
Default: true.
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 application command so that all apps are created in the projects folder.
Default: true.
When true, runs through
and reports activity
without writing out
results.
Default: false.
Aliases: -d.
When true, forces
overwriting of existing
files.
Default: false.
Aliases: -f.
Shows a help message for this command in the console.
Default: false.
When true, includes styles inline in the component TS file. By default, an external styles file is created and referenced in the component TS file.
Default: false.
When true, includes styles inline in the componentTS file. By default, an external styles file is created and referenced in the component TS file.
Default: false.
Aliases: -t.
When true, creates a project without any testing frameworks. (Use for learning purposes only.)
Default: false.
The path where new projects will be created, relative to the new workspace root.
Default: projects.
The prefix to apply to generated selectors for the initial project.
Default: app.
Aliases: -p.
The prefix to apply to generated selectors for the initial project.
Default: app.
Aliases: -p.
When true, does not
initialize a git repository.
Default: false.
Aliases: -g.
When true, does not install dependency packages.
Default: false.
When true, does not generate "spec.ts" test files for the new project.
Default: false.
Aliases: -S.
Creates a workspace with stricter TypeScript compiler options.
Default: false.
When true, adds more details to output logging.
Default: false.
Aliases: -v.
An example for ng new command is given below −
\>Node ng new TutorialsPoint
? Would you like to add Angular routing? Yes
? Which stylesheet format would you like to use? CSS
CREATE TutorialsPoint/angular.json (3630 bytes)
CREATE TutorialsPoint/package.json (1291 bytes)
CREATE TutorialsPoint/README.md (1031 bytes)
CREATE TutorialsPoint/tsconfig.json (489 bytes)
CREATE TutorialsPoint/tslint.json (3125 bytes)
CREATE TutorialsPoint/.editorconfig (274 bytes)
CREATE TutorialsPoint/.gitignore (631 bytes)
CREATE TutorialsPoint/browserslist (429 bytes)
CREATE TutorialsPoint/karma.conf.js (1026 bytes)
CREATE TutorialsPoint/tsconfig.app.json (210 bytes)
CREATE TutorialsPoint/tsconfig.spec.json (270 bytes)
CREATE TutorialsPoint/src/favicon.ico (948 bytes)
CREATE TutorialsPoint/src/index.html (300 bytes)
CREATE TutorialsPoint/src/main.ts (372 bytes)
CREATE TutorialsPoint/src/polyfills.ts (2835 bytes)
CREATE TutorialsPoint/src/styles.css (80 bytes)
CREATE TutorialsPoint/src/test.ts (753 bytes)
CREATE TutorialsPoint/src/assets/.gitkeep (0 bytes)
CREATE TutorialsPoint/src/environments/environment.prod.ts (51 bytes)
CREATE TutorialsPoint/src/environments/environment.ts (662 bytes)
CREATE TutorialsPoint/src/app/app-routing.module.ts (246 bytes)
CREATE TutorialsPoint/src/app/app.module.ts (393 bytes)
CREATE TutorialsPoint/src/app/app.component.html (25755 bytes)
CREATE TutorialsPoint/src/app/app.component.spec.ts (1083 bytes)
CREATE TutorialsPoint/src/app/app.component.ts (218 bytes)
CREATE TutorialsPoint/src/app/app.component.css (0 bytes)
CREATE TutorialsPoint/e2e/protractor.conf.js (808 bytes)
CREATE TutorialsPoint/e2e/tsconfig.json (214 bytes)
CREATE TutorialsPoint/e2e/src/app.e2e-spec.ts (647 bytes)
CREATE TutorialsPoint/e2e/src/app.po.ts (301 bytes)
Packages installed successfully.

Here, ng new command has created an angular workspace and a project with name TutorialsPoint in our Node directory.

    16 Lectures 
     1.5 hours 

 Anadi Sharma

    28 Lectures 
     2.5 hours 

 Anadi Sharma

    11 Lectures 
     7.5 hours 

 SHIVPRASAD KOIRALA

    16 Lectures 
     2.5 hours 

 Frahaan Hussain

    69 Lectures 
     5 hours 

 Senol Atac

    53 Lectures 
     3.5 hours 

 Senol Atac
 Print
 Add Notes
 Bookmark this page