How to Create first Angular Project using Command Line Interface ?

Steps Involved are:-

  • Download and install node js. Node provider some tools to build Angular project.
  • Use NPM to install angular CLI. Refer here to Install Angular CLI
  • Command to create a new project in angular
    ng new hello-world

    Below are the screenshots of the project creation process.






  • During setting up of project it will ask for enabling angular routing. enter yes and continue.
  • Also, choose the style sheet format for the project.
  • After the project creation is successful it will try to integrate git with the mail present in the system. if it cannot find a proper git configured email it will ask to enter the name and email id to integrate with git.if you are not using git, you can ignore this step.
  • Finally to run the project type below command
    ng serve
    The default port for angular is 4200.project will be running in URL http://localhost:4200/ after compiling.

How to install Angular CLI?

To install Angular CLI we need node js in the system .so download the latest stable node js.
Node provides some tools to build Angular projects. It helps to execute Javascript code outside the browser.

After installing node js we use NPM(Node Package Manager) to install third-party libraries. To install Angular CLI.

npm install -g @angular/cli

-g in the command specifies your installing the Angular CLI globally.

To check if the installation is successful.

ng --version

Angular CLI screen shot