How to Install Angular 5 (Tutorial)

I feel like people are not understanding that Angular 5 is not a new framework nor was 4. There are very few changes on the surface, it is just semantic versioning. Its all just “Angular”, just like we do not say React 16. There are only 2 different frameworks and that is AngularJS (Version 1) and Angular. Everything you know about Angular 2 applies to 4,5 and 6+ when it is released. So saying “I just learned Angular 4” makes NO sense. Angular 5 is Angular 4 with a few improvements mostly under the hood, making it faster. I don’t mean to sound like a prick but I see the same dumb comments over and over and if they just took a second to look get informed they would get it 🙂

However, if you have no previous experience with Angular, don’t worry — installing Angular 5 is a breeze. So, let’s get started.

Prerequisites
You’re going to need a couple things before proceeding:

Node.js
Node Package Manager (NPM)
To check whether or not you have both of these installed, visiting your command line or console and type:

[bash]
$ node -v
$ npm -v
[/bash]

If either of these commands is unrecognized, visit the downloads section of Nodejs.org and download/run the appropriate installer based on your OS.

Follow the installation steps with default settings, which will install NPM by default. Once finished, reload your command line/console and retype the above commands — they should now give you version numbers.

Installing Angular 5 through the CLI

The Angular CLI (Command Line Interface) is the quickest and easiest way to get started with a brand new Angular 5 project.

We’re going to use NPM (you can also use yarn) to install the Angular CLI through the following command:

[bash]
$ npm install @angular/cli -g
[/bash]

Once installed, you can access the CLI tool by typing ng.

To check the version of your Angular CLI, type:

[bash]
$ ng -v
Angular CLI: 1.5.0
Node: 6.10.0
OS: win32 x64
Angular:

[/bash]

As you can see, mine is currently at version 1.5.0. Great, now we’re ready to use the CLI to start the project.

To install Angular 5 through the CLI, type:

[bash]
$ ng new my-new-project –style=scss –routing
[/bash]

The two flags we added at the end specify that we want the CSS to use the Sass compiler, and –routing tells the CLI to provide us with the routing scaffolding.

It will run for awhile and then prompt you that you can cd into the new project folder. To do that, simply type:

[bash]
$ cd my-new-project
[/bash]

To serve your project in the browser, which is useful for development as it automatically compiles your project and reloads it in the browser, type:

[bash]
$ ng serve
[/bash]

And that’s it! You have a fresh copy of Angular 5 ready and waiting for you to develop.

In Next Tutorial “Angular 5 Components Tutorial” we are going to see how to generate the component using angular CLI.

Add a Comment

Your email address will not be published. Required fields are marked *