In this tutorial, we will learn about some basic commands which are commonly used in Angular cli.
This command is used to create a new angular project.
ng new myapp
This command is used to generate new components, routing modules, services, and guards.
ng generate component myfirst-component #where myfirst-component is your component name
This above command can also be written as
ng g c myfirst-component # g means generate # c means component
ng g s my-service #s means service
This above command will create new services in your app, by default services are injected into root level.
ng generate guard auth-guard #where auth-guard is your guard name
Once 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 ◯ CanLoad
ng generate directive emoji
This command will create a new custom directive called
emoji in your app folder.
This command is used to start the local development server so that you can develop your favorite app on your pc.
This command is used to run the unit tests in a project.
This command is used to run the end to end tests in a project.
This command is used to build your app for production use.