Angular cli commands list
In this tutorial, we will learn about some basic commands which are commonly used in Angular cli.
ng new
This command is used to create a new angular project.
ng new myappng generate
This command is used to generate new components, routing modules, services, and guards.
Create new components
ng generate component myfirst-component
#where myfirst-component is your component nameThis above command can also be written as
ng g c myfirst-component
# g means generate
# c means componentCreate new services
ng g s my-service
#s means serviceThis above command will create new services in your app, by default services are injected into root level.
Create route guards
ng generate guard auth-guard
#where auth-guard is your guard nameOnce you run this above command you will see three available guards and you need to choose which guard is required for you.
? Which interfaces would you like to implement?
(Press <space> to select, <a> to toggle all, <i> to invert selection)
❯◯ CanActivate
◯ CanActivateChild
◯ CanLoadCreate custom directives
ng generate directive emojiThis command will create a new custom directive called emoji in your app folder.
ng serve
This command is used to start the local development server so that you can develop your favorite app on your pc.
ng serveng test
This command is used to run the unit tests in a project.
ng testng e2e
This command is used to run the end to end tests in a project.
ng e2eng build
This command is used to build your app for production use.
ng build

