Introduction Angular CLI Commands
The Angular CLI is a tool for managing, building, maintaining, and testing your Angular projects. CLI is an acronym for Command Line Interface. Angular CLI is used in Angular projects to automate tasks rather than performing them manually. Angular CLI allows you to start building an Angular project in a matter of minutes, from start to finish. How to Install Angular CLI.
Installing Angular CLI
To install the Angular CLI, open a terminal window and run the following command or using the npm package manager
npm install -g @angular/cli
After adding Angular CLI, Verify the configured version after you’ve added all of the packages using
ng –version.
Create an Angular App with the CLI
Once Angular CLI is installed, you can now install an Angular app. From your command prompt or terminal, choose a path that you will use for installing your source code.
For example, if you choose to have the Desktop as the file location with cd command, you can type this command to create angular app
ng new my-first-Angularapp
The command will install your first Angular project with all the required configurations
Run Angular App
ng serve
Once you type in the command, it will start your Angular app and the open command will open the application automatically in your web browser.
Angular CLI Commands
ng new my- first–app : it will create new angular app with name my-first-app
ng build : It will build your angular app
ng serve : This command build and run your angular app
ng test : used for testing
ng e2e: used for end to end testing
ng g module my-module : create new module
ng g component my-component : create new component
ng g directive my-directive : create new directive
ng g pipe my-pipe: create new pipe
ng g service my-service: create new service
ng g interface my-interface : create new interface
ng g enum my-enum: create new enum