Angular CLI installation basicsBefore you dive into your new application, here are some Angular CLI installation basics. This tool simplifies the process of scaffolding out your base code and new components.

This article provides a high-level introduction to Angular CLI installation basics. The Angular CLI is a powerful tool that can dramatically reduce the amount of time you spend coding, while improving the quality of the code. It allows you to use all of the power of the Angular framework in a much more straightforward way. We’ll get started with the Angular CLI by installing it along with the software required to run it. Then, we’ll test it to make sure we don’t have any errors.

Angular is a JavaScript framework for managing common functionality that specializes in data binding. It’s perfect for building web applications that need to update their content as a user interacts with it. Angular uses a component architecture, which means you build modular sections of code called components that can be combined and reused as needed.

Requirements for the Angular CLI Installation Basics

There are a few things you will need before you can get started with the Angular CLI installation basics and use Angular in your development projects. If you don’t already have these programs, we will include links to download them. Setup is very easy for this software. There is no charge for any of it and they only require you to download the version for your operating system and then run the installers.

Node.js

For your Angular CLI installation basics, you’re going to need Node 6.9.0 or higher. You can check which version of Node.js you have by typing node –v into your command prompt.

Link to Node.js Software: https://nodejs.org/en/

NPM

You’re also going to need NPM 3 or higher. You can check which version of NPM you have by typing node –v into your command prompt. NPM is installed along with Node.js if you follow the link above. That link will install Node and NPM for any operating system.

Editor

And finally, you’re going to need editing software to edit and work on your code. There are plenty of editors to choose from and it doesn’t matter which one you use, as long as you are comfortable with it. We recommend software titled Visual Studio Code. The Visual Studio Code editor is very robust, it’s cross-platform, open-source, and you can use the command prompt from inside the work environment.

Link to Visual Studio Code Editor Software: https://code.visualstudio.com/

Git

Git is an entirely optional version control system that has nothing to do with Angular or Angular CLI directly. You do not need GIT for the Angular CLI installation basics, but as an extremely popular way to develop and share code, it can be very useful to have on hand. I have found that a lot of Angular tutorials and guides begin by having you download a project from Git. If you don’t have GIT yet, you can get it at https://git-scm.com/, along with documentation about using it.

Command Prompt

The Command Prompt is where we do all of our work in the Angular CLI.

  • If you use Windows 10, the easiest way to get to the command prompt is by typing command prompt into the search field on the bottom left-hand side of your screen. You can also type Run -> CMD.
  • On Mac, you find the terminal by following Applications -> Utilities -> Terminal.
  • On Linux, you can press CTL ALT T.

Command Prompt Cheat Sheets

Here are a few cheat sheets to help you learn the most important commands to use with the command prompt.

Windows

Common command prompt commands for windows: https://www.makeuseof.com/tag/essential-windows-cmd-commands/

Mac

Common command prompt commands for mac: https://www.makeuseof.com/tag/mac-terminal-commands-cheat-sheet/

Linux

Common command prompt commands for Linux: https://www.networkworld.com/article/3337516/the-linux-command-line-cheat-sheet.html

Install Angular CLI

Once you have Node.js and NPM installed, it’s time to install the Angular CLI. To install the Angular CLI, open the command prompt, and type npm install-g@angular/cli. Doing so will install the Angular CLI and give you a list of commands that you can use to interact with it.

Examples

Let’s try out some of these commands to make sure everything is working correctly.

Example 1

The first command we’ll try will list the available commands. To get a list of available commands, type ng, and press enter or return.

Example 2

In Example 2, we are going to one of the commands to find out which version of the Angular CLI we have downloaded. To get the version number, we use the command ng v.

You can see that this command is very similar to the ones that give us the version of Node.js and NPM. The ng represents the Angular CLI the same way node represents Node.js, and npm represents NPM. The v in all three stands for version, but the Angular CLI does not require the dash before the v as the others do. You can also type out the word version if you prefer, making the command ng version.

Conclusion

So, to summarize the Angular CLI basics, as long as you got a response in your command prompt when you tried the two examples, your Angular CLI works and is ready to go. The Angular CLI will significantly reduce the amount of time required to begin a new angular application, and it also eliminates the need to type out repetitive boilerplate code. The framework follows all of the best coding practices. It allows you to test your code and create an optimized build before your application deploys to the real world.

If you have enjoyed reading about Angular CLI basics, and were able to set it up and get it running, please share this guide to Angular CLI installation basics on Facebook and Twitter.