How to Set Up a New Angular Project
To set up a new Angular project, you will need to have Node.js and the Angular CLI (Command Line Interface) installed on your computer.
- Install Node.js: Go to the official Node.js website and download the latest version of Node.js for your operating system.
-
Install the Angular CLI: Open a terminal or command prompt and run the following command:
npm install -g @angular/cli
-
Create a New Project: Run the following command in the terminal or command prompt:
ng new my-first-app
Replace my-first-app with your desired project name. -
Run the Project: Navigate to the project directory using:
cd my-first-app
Then start the development server by running:ng serve
The app will open in your default browser at http://localhost:4200.
Additional Tips
You can create components, services, and pipes using the Angular CLI. Use the following commands:
ng generate component component-name
ng generate service service-name
ng generate pipe pipe-name
These are the basic steps to set up an Angular project. You can further enhance it using tools like Angular Schematics and Angular Material.
0 Comments