Quick Angular CLI Reference ← Alligator.io | angular cli cheat sheet
Webrieflyintroduced[1]theAngularCLIalready,andhere’saquickpostthatshouldhelpyoufindthecommandsyouneedformostthingsyouwouldwanttodowiththeCLI.WhichVersion?SeewhichversionoftheCLIyou’reusing:$ng--versionNeedtoupdate?Runthis:$npmuninstall-g@angular/clicacheclean$npminstall-g@angular/cli@latestHelpGetgeneralhelp:$nghelpOrgethelpforaspecificcommand:$nghelpgenerateNewProjectGenerateanewproject:$ngnewmy-appAndhereareafewflagsyoucanuse:--dry-run:Seewhichfileswouldbecreated,butdon’tactuallydoanything...
We briefly introduced[1] the Angular CLI already, and here’s a quick post that should help you find the commands you need for most things you would want to do with the CLI.
Which Version?See which version of the CLI you’re using:
$ ng --versionNeed to update?Run this:
$ npm uninstall -g @angular/cli cache clean $ npm install -g @angular/cli@latestHelpGet general help:
$ ng helpOr get help for a specific command:
$ ng help generateNew ProjectGenerate a new project:
$ ng new my-appAnd here are a few flags you can use:
--dry-run: See which files would be created, but don’t actually do anything.--verbose: Be more chatty.--skip-install: Don’t npm install, useful when offline or with slow internet.--skip-tests: Don’t create spec files.--skip-git: Don’t initialize a git repo.--source-dir: Name of the source directory--routing: Add routing to the app.--prefix: Specify the prefix to use for components selectors.--style: Defaults to css, but can be set t...