Angular & CLI (Command Line Interface)

web
mobile

Author: Dawid Adach

-

Live stream

Staying home? Join our free webinar & use free time to learn!

learn more

Goal

The goal of the following tutorial is to guide you on how to install Angular on your local machine. This requires both Node.js and NPM to be installed on your machine. If you don't have it or don't know if you have, please check the previous tutorial. If you already have it we can start installing Angular!

Angular and Angular CLI

Angular is a TypeScript-based open-source front-end web application platform led by the Angular Team at Google and by a community of individuals and corporations. Teh angular Command Line Interface (CLI) is a tool which helps you to scaffold and build Angular apps using modules. It also handles common tedious tasks for you. We will show it in the example but first - let's install it.

1. Installation

Open the terminal and run:

npm install -g @angular/cli

Next we will install Typescript - a superset of JS, that we will learn more about in later lessons, for now just note that it's required by Angular

npm i -g typescript

2. Verify the installation

Run the following command in the terminal:

ng -v

You should see the current version of Angular, CLI and Typescript:

hello world

3. First Angular app

Since everything is ready, we are ready to create our first Angular app. Open the terminal and run the following command:

ng new hello-world

Expected output:

new new cli

Now let's navigate to our new project:

cd hello-world

and run:

ng serve -o

Expected output:

new serve

Our browser should automatically open (cause we added the -o option) new window/card in our default web browser and display the following content. If that didn't happen, then open a browser manually and navigate to

http://localhost:4200/
new serve

Now let's get back to our current project.Click the NEXT LESSON button to proceed further.


Rate this lesson

Previous lesson Next lesson

Spread the word:
Do you need help? Use our support forum

About the author

Dawid Adach
For more than 5 years Dawid worked as an IT Consultant specializing in SOA/EAI/ESB in the banking domain. He gained experience working in countries like Netherlands, Belgium, Poland and India developing enterprise-class systems for the most prestigious companies. Since co-founding mdbootstrap.com & brandflow.net in 2016 he has been using and teaching technologies such as Angular, TypeScript, PHP, AJAX, Mongo, SQL, Hadoop Stack, Virtualization, Automation and many others...