Angular Cli
Angular Cli
Setup Notes
npm i -g @angular/cli Install latest version Certain Blueprints (components/modules) create a folder - unless a
ng -v check your CLI version folder has already been created. Use the --flat flag to prevent a folder from
being created. Service & Interface do not create folders.
ng --help show all commands in terminal
ng doc (component) open Angular documentation Remember to consider where components should reside. You may
want to add a login component inside an account module. This would be
Main Commands done by first creating the module ng g m account --routing then adding the
login component inside account and importing it the correct module ng g c
ng new ng new myApp create a new project
account/login -m=account.
ng serve ng s -o compile and open
Common Flags
ng add - Schematics
COMMAND FLAG ALIAS DESCRIPTION
ng add @angular/pwa app manifest +
All --help list flags (new/s/g) service worker
All --dry-run -d show potential file changes ng add @ng-bootstrap/schematics add ng-Bootstrap
New --skip-tests -S no spec files
ng add @angular/material install Material
New --skip-install don't install dependencies
ng add @clr/angular@next install Clarity Design
New --prefix -p ng prefix for all selectors
ng g Table
@angular/material:material-table --
name=table
Blueprints
component c
service s
pipe p
interface i
module m
class class
Blueprint Examples