Angular is one the most popular javascript front-end framework for creating full-fledged web applications. Angular comes with command line interface to the development faster.In this article, We will see the CLI commands a developer should know.
What is Angular CLI?
Angular CLI is a command-line interface that is used to create Components, Services, Pipes, modules, and more. It is very helpful for the developers and makes the development faster.
Now we will see the list of commons which a Angular developer should
- ng new <application name>: This command mainly creates a new Angular application
- ng new <application name> --prefix best: This command creates a new Angular application and set the projects prefix to new.
- ng new --help: This command mainly list Angular command.
- ng lint my-app: This command checks the selected application for any linting warning
- ng lint my-app --fix: It helps in fixing linting error, if there is any
- ng lint my-app --format stylish: This formats entire codebase.
- ng lint my-app --help: This command list all the available linting command list.
- ng generate directive <directive name>: This command generates a new directive. This command can also be written as ng g d <directive name>.
- ng generate component <name>: This command mainly creates a new components. This command can also be written in short form as ng g c <name>
- ng g s <service name>: This command is used to create a new service.
- ng g p <pipe name>: It helps to create a new pipe in our application
- ng g cl <destination>: It helps to create a new class in specified directory.
- ng build: It helps to create a development build of our Angular application.
- ng build --prod: It helps to create production build in angular application.
- ng serve -o: It serves the application by opening up the application in a browser using any port 4200 or any other.
- ng serve -ssl: Serves the application using SSL.
In this article, I tried to brief the common Angular CLI command any Angular developer should know.
Let me know your thoughts over the email pankaj.itdeveloper@gmail.com. I would love to hear them and If you like this article, share it with your friends.
Thanks,