Angular Setup with the CLIπ± Beginner
The only standard way to create, build, and manage an Angular application is by using the Angular CLI (Command Line Interface). It is a tremendously powerful tool that scaffolds your entire architecture.
What is the Angular CLI?
The Angular CLI is an official NPM package provided by Google. It not only creates your initial project folder but is also used continuously throughout development to generate new components, services, and modules perfectly formatted to Angular's strict standards.
Why is the CLI Mandatory?
An Angular component requires multiple files (a TypeScript class, an HTML template, a CSS file, and a Spec file for testing). Creating and linking these manually is incredibly tedious and error-prone. The CLI automates all of this boilerplate instantly.
How to Install and Create an App
First, install the CLI globally on your machine via NPM:
# Install the Angular CLI globally (-g)
npm install -g @angular/cli
# Verify the installation
ng versionNow, use the ng new command to scaffold your application:
# Create a new app (prompts will ask about routing and CSS)
ng new my-angular-app
# Navigate in
cd my-angular-app
# Start the local development server
ng serveYour massive enterprise app is now running locally on http://localhost:4200.
ng new, always accept the option to add Angular Routing, and choose SCSS instead of standard CSS. SCSS allows for nested styling and variables, which is a must-have for large projects.