Buy my Angular book for building 5+ step by step examples!

How to Install Angular 9 CLI and Create an Angular 9 Project with Routing

December 27, 2019 | 1 Minute Read

In this tutorial, we’ll install the latest Angular CLI version and generate a new Angular 9 project with routing.

Let’s get started.

Step 1 — Setting up Angular CLI v9

In our first step, we’ll proceed to install the latest Angular CLI 9 version.

Note: You can also use Angular 8 with this tutorial.

Angular CLI

Open a new command-line interface and run the following command:

$ npm install -g @angular/cli@next

This will install angular/cli v9.0.0-rc.2 as the time of writing this tutorial.

In the next step, we’ll proceed to create a new example project from the command-line.

Step 2 — Creating a New Angular 9 Project

In our second step, we’ll use Angular CLI to create our example project. Go back to your terminal and run the following commands:

$ cd ~
$ ng new angular-example-with-routing

You’ll get prompted for a couple of things — If Would you like to add Angular routing? Say y and Which stylesheet format would you like to use? Pick CSS.

This will set up routing in our project and set CSS as the stylesheets format for components.

Next, go to the root folder of your project and run the local development server using the following commands:

$ cd angular-example-with-routing
$ ng serve    

A live-reload server will be running from the http://localhost:4200/ address:

Latest Questions and Answers

How to add Bootstrap 4 to my Angular 9 app?
What’s the use of TypeScript 3.8/ECMAScript Private Fields?
How to update/Upgrade Angular 8 to Angular 9 by CLI ng update?
How to Install and Use jQuery with Angular 9?
How to Upload Image Files with Laravel 7 and Angular 9?
What Is Angular 9 ivy?
What’s Alpine.js vs, React, Vue.js and Angular?
How to Use HttpClient Module and Service to Send Ajax/Http Requests in Angular 9?
How to Create a New Angular 9 Project Using npm?