Home >>Angular 6 Tutorial >Angular 6 CLI

Angular 6 CLI

Angular 6 CLI

Angular CLI makes every Angular Project quick to launch. Angular CLI comes with commands that help us build and get started really quickly on our project. Now let's go over the available commands to build a project, a component, and services, change the port, etc.

We need to have it installed on our system to work with Angular CLI. Let us use the command below for the same –

npm install -g @angular/cli

We will execute the following command in the command line to build a new project, and it should create the file.

ng serve //

ng serve // will compile and you can see the output of your project in the browser −


4200 is the default port to use when creating a new project. The following command − will adjust the port.

ng serve --host --port 4201

The following table lists down a few important commands required while working with Angular 4 projects.

Component ng g component new-component
Directive ng g directive new-directive
Pipe ng g pipe new-pipe
Service ng g service new-service
Module ng g module my-module

Whenever a new module, a component, or a service is created, the reference of the same is updated in the parent module app.module.ts.