Angular – Setup in your local computer with CLI

Prerequisites:
Node.js and npm, node 6.9.x or above & npm 3.x.x or above

Angular CLI (Command-Line Interface) provides the simplest way to setup an Angular app into local computer.

1. Install Angular CLI.
Use npm command. Run this in either bash or command prompt.

npm install -g @angular/cli

2. Verify if Angular CLI is installed successfully by following command.

ng version

3. Create a new project e.g.PROJECT_NAME. This may take a while.

ng new PROJECT_NAME

4. The ng-serve with -o will automatically open http://localhost:4200/ in default browser.
The app will automatically refresh if you change any of the source files.

cd PROJECT_NAME 
ng serve -o

5. To change the default host and port number, use the following command.

ng serve --host 0.0.0.0 --port 4201

You are all set!