Before you can build an Angular application, you need to set up your local development environment.
Angular relies heavily on Node.js and its package manager, NPM.
In this tutorial, we will install the necessary tools and generate our first project.
Angular requires an active, long-term support (LTS) version of Node.js.
You can download and install Node.js directly from nodejs.org.
To verify your installation, open your terminal and run the following command:
node -v npm -v
The Angular CLI (Command Line Interface) is an essential tool for modern Angular development.
It is used to initialize, develop, scaffold, and test your applications directly from the terminal.
To install the CLI globally on your computer, use the following NPM command:
# The -g flag installs the package globally across your whole system npm install -g @angular/cli
Once the CLI is installed, creating a new project takes only a single command.
Navigate to the directory where you want your project to live.
Then, use the ng new command followed by your desired project name.
ng new my-first-angular-app
The CLI will prompt you with a few setup questions, like whether you want to include Angular routing.
It will also ask which stylesheet format you prefer (CSS, SCSS, Sass, or Less).
Select "Yes" for routing and "CSS" for styling to keep things simple for now!
The ng new command will take a few minutes to complete.
It is downloading massive amounts of boilerplate code and installing all required NPM dependencies.
In the next chapter, we will explore this newly created folder structure and launch the app in the browser!
What underlying technology must be installed on your computer before you can use the Angular CLI?
Which CLI command is used to generate a brand new Angular project?