Angular CLI Workspace Cheat Sheet

July 15, 2018 ยท View on GitHub

You must first generate a new project before using workspaces:

ng new my-app

generate

Generate a new project:

ng g application my-project

Generate a new lib:

ng g lib my-lib

generate component

Generate a new component within a project:

ng g c my-component --project my-project

It's the same to generate a new component within a lib:

ng g c my-component --project my-lib

generate service

Generate a new service within a project:

ng g s my-service --project my-project

It's the same to generate a new service within a lib:

ng g s my-service --project my-lib

serve

Serve the root application:

ng s

Serve a project:

ng s my-project

build

Build the root application:

ng b

Buid a project:

ng b my-project

Buid a lib:

ng b my-lib