← 返回命令列表

Linux command

ng 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Create new project

ng new [project-name]

Serve application

ng serve

Build application

ng build

Generate component

ng generate component [name]

Generate service

ng generate service [name]

Run tests

ng test

Run e2e tests

ng e2e

Add library

ng add [package-name]

说明

ng is the Angular CLI. It creates and manages Angular applications. The tool scaffolds projects. Handles building, testing, and deployment.

参数

new _NAME_
Create new project.
serve
Start dev server.
build
Build project.
generate _TYPE_ _NAME_
Generate code.
test
Run unit tests.
--help
Display help information.

FAQ

What is the ng command used for?

ng is the Angular CLI. It creates and manages Angular applications. The tool scaffolds projects. Handles building, testing, and deployment.

How do I run a basic ng example?

Run `ng new [project-name]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does new _NAME_ do in ng?

Create new project.