Angular CLI (Command Line Interface) is a powerful tool that helps developers quickly scaffold, develop, and maintain Angular applications. It provides commands for project creation, building, testing, and deploying applications efficiently.
Before installing Angular CLI, ensure that you have the following requirements:
You can check if Node.js and npm are installed by running:
node -v
npm -v
If not installed, download and install Node.js from Node.js official website.
Once Node.js is installed, install Angular CLI globally using npm:
npm install -g @angular/cli
To verify the installation, check the version:
ng version
This should display the Angular CLI version along with Angular dependencies.
Use the following command to create a new Angular project:
ng new my-angular-app
You will be prompted to choose configurations such as routing and styling (CSS, SCSS, etc.). Once selected, the CLI will set up the project.
Navigate to the project directory:
cd my-angular-app
To serve the application locally, use:
ng serve
The application will be available at http://localhost:4200/ on your Virtual Machine.
Here are some essential Angular CLI commands:
The angular.json file contains project configuration settings such as build, serve, and test options. You can customize build paths, output directories, and assets.
By following these steps, you have successfully installed and set up Angular CLI. This tool streamlines the development workflow, making it easier to manage Angular applications. Start exploring Angular CLI commands to enhance your development experience!