Top Angular CLI commands
Some basic commands of Angular are as below:
- Npm install –g @angular/cli: This command is basically used for installing the Angular CLI in specifically mention package manager of rpm.
- Ng help: Providing available online help related to angular by executing this command. This help can be varieties option, list of details will come in the prompt.
- Ng generate –help: It gives an entire list of executable commands in angular with mentioning some common short description. The user can easily able to understand which command needs to be used for what purpose by executing this command. It is also basically providing online help in angular with some additional short description for proper user visibility.
- Ng new first–angular-project: This command is using for creating one new basic project in angular, the developer should need to go to the corresponding workspace and executing this command for creating one new project.
- Cd first-angular-project: Cd means change directory. This command is actually moving the user cursor to the created project folder.
- Ng serve: This command is basically helping for building the app and ensure its availability locally. By executing this command server is responsible to automatically rebuild entire code changes and reloads the same immediately in the pages if the developer changes anything in the source file. This is very much popular command in Angular for building the app and display the corresponding changes in the screen.
- Ng config: This command is basically helping for retrieving all the configurations details and option for setting or editing the corresponding set up configuration from the command prompt. There have another option to edit the configuration rather than executing this command that is edit angular.json file directly. There have some common mechanism need to be followed by the angular developer, like configuration file name should maintain in camel case whereas option name of executing command can be in camel case or normal.
- Ng –build my-first-app –c production: This command is basically using for building the new application which developed and as well as copy the same build application to the production environment promptly. This command is helpful for switching entire change immediately to the deliverable environment. This command must need to execute inside the workspace directory. After executing this command, it generated one output directory with name dist/ on the provided output path.
- Ng add: This command is basically using for an external library. Suppose developer needs to include some of the external libraries in their existing project, in that case, they can easily use add command and specify the name of the external library. Then it will automatically include that library into the application.
- Ng doc: This command is very much helpful for understanding the angular official view. This command is actually opening angular official documentation like angular.io in the corresponding default browser. It also gives critical utility of searching with some specific keyword for gaining the knowledge on that keyword from the angular official site directly.
- Ng e2e: This is very much useful for the common developer especially in the case of an end to end testing on the angular developed app. Executing this command ensure of building the app and serve the same locally with the update changes. Then also it runs on end to end testing environment by using one of the protractors.
- Ng lint: This is for linking the angular app with one popular tool linting. It helps for running this linting tool on the developed code in angular on the provided folder of the project. It basically ensuring code quality.
- Ng run: This command is basically helping for running one of the architect targets by taken help with the custom optional building configuration. This kind of configuration normally defined earlier associated with the project.
- Ng test: This is helping for running entire unit test cases on the angular project.
- Ng update: This command is mainly helping for updating the application and their corresponding dependency periodically.
- Ng version: This command provides the proper version of the angular CLI.
- Ng xi18n: This command is mainly helping for extracting the information of i18n messages from the written source code of angular.
So, thanks for following this blog, and if you need any help please leave your queries in the comment box we will be happy to help you.