Creating a new app

In this section you will learn how to develop a brand new Angular application using Angular CLI., the command line interface for Angular.

In the following portion of code you can find the commands to execute into an Ubuntu 17.10 server.

# Installing Node.js.
sudo apt install curl
curl -sL | sudo -E bash -
sudo apt-get install -y nodejs
# Installing Angular CLI.
sudo npm install -g @angular/cli

Once done, the creation of a new Angular application can be completed using the following command.

ng new my-project

Into the brand new my-project folder you will find a ready-to-be-used project implementing a very basic Angular application.

Before considering as completed the task, let's edit the src/app/app.module.ts file and add the following source code.

import { RouterModule, Routes } from '@angular/router';
const appRoutes: Routes = [];
  imports: [

Now edit the src/app/app.component.html file and replace the entire content with the following one.

  <a href="/">Home</a>

To import and install all the dependencies, launch the npm install command from the root folder of the project.

To launch the application, run the npm start command and open a browser at http://localhost:4200. Below a screenshot showing some links in addiction to the home introduced above

results matching ""

    No results matching ""