Start new angular project
Here's a step-by-step guide to start a new Angular project:
Prerequisites:
- Node.js installed on your machine (version 14 or higher)
- npm (Node Package Manager) installed on your machine
- Angular CLI (Command-Line Interface) installed on your machine (you can install it by running
npm install -g @angular/cli
)
Step 1: Create a new Angular project
Open your terminal or command prompt and run the following command:
ng new my-app
Replace my-app
with the name of your project.
Step 2: Choose the project template
You will be prompted to choose a project template. You can choose from the following options:
blank
: A blank project with no pre-built components or features.routing
: A project with routing enabled.service-worker
: A project with a service worker enabled for offline support.pwa
: A project with Progressive Web App (PWA) features enabled.
Choose the template that best suits your needs.
Step 3: Configure the project
You will be asked to configure the project. You can choose to:
- Use a CSS preprocessor (e.g., Sass or Less)
- Use a JavaScript library (e.g., jQuery or Lodash)
- Set the project's language and region
Choose the options that best suit your needs.
Step 4: Create the project
Once you've configured the project, the Angular CLI will create the project structure and install the necessary dependencies.
Step 5: Navigate to the project directory
Change into the project directory using the following command:
cd my-app
Step 6: Start the development server
Start the development server using the following command:
ng serve
This will start the development server and open your project in your default web browser.
Step 7: Start building your app
You can now start building your Angular app by creating components, services, and other features.
That's it! You've successfully created a new Angular project using the Angular CLI.