Angular CLI

npm install -g @angular/cli
ng new my-new-app
cd my-new-app
ng serve
ng generate component cmp
ng generate service srv

Show Angular version:

ng --version

Angular CLI commands for scaffolding

ng generate component component-name
ng generate directive directive-name
ng generate pipe pipe-name
ng generate service service-name
ng generate class class-name
ng generate guard guard-name
ng generate interface interface-name
ng generate enum enum-name
ng generate module module-name

Get help on the command:

ng serve --help
ng generate component --help
ng generate service --help

Check the linting errors:

ng lint

Deploy to production (all the files will be in the 'dist' folder):

ng build --configuration=production

Build files to run locally without the server:

ng build --configuration=production --base-href ./

Install existing project:

npm install

Run this if needed (the terminal will tell you that):

npm audit fix


npm install -g firebase-tools
firebase login
firebase init
firebase deploy


Leave a Comment