Friday, March 20, 2020

Angular Commands

The following are the list of Angular Commands.

New Angular Project:
  • ng new ProjectName e.g. ng new hello-World (Default)
  • ng new hello-world --skipGit (Without Git Folder)
  • ng new hello-world --skipTests --minimal (Without test folder) 

Compile and Run Angular Application:
  • ng serve (Only run of Angular Application)
  • ng serve -o (To Build and run Angular Application)

Create Component in Angular
:
  • To Create Component with Default Options
    • ng generate component ComponentName or ng g c ComponentName
      • e.g. ng generate component test1 (Default)
      • e.g. ng g c test1 (short version)
  • To Create Component without "HTML" & "CSS" Files
    • ng generate component ComponentName -it -is or ng g c ComponentName -it -is
      • e.g ng g c test2 -it -is
  • To Create Component without "Test File", "HTML" & "CSS" Files:
    • ng generate component ComponentName -it -is --skipTests or ng g c ComponentName -it -is --skipTests 
      • ng g c test3 -it -is --skipTests
  • To Create Component without "Folder", "Test File", "HTML" & "CSS" Files:
    • ng generate component ComponentName -it -is --skipTests --flat or ng g c ComponentName -it -is --skipTests --flat
      • ng g c test4 -it -is --skipTests --flat

Other Commands:
  • To Check the Angular version
    • Version: ng --version (No longer works)
    • Version: ng v or ng version
  • To install Angular
    • npm install -g @angular/cli
  • To install a specific version of Angular
    •  npm install -g @angular/cli@16.0.0
  • To uninstall Angular
    • npm uninstall -g @angular/cli 

2 comments: