Create new project in angular 7
Here are the steps to create a new project in Angular 7:
Prerequisites:
- Node.js installed on your machine (version 10 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 project
Open a terminal or command prompt and run the following command:
ng new my-new-project
Replace my-new-project
with the name of your project.
Step 2: Choose the project template
The Angular CLI will prompt you 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.pwa
: A project with a progressive web app (PWA) enabled.
Choose the template that best fits your needs.
Step 3: Configure the project
The Angular CLI will ask you to configure the project. You can choose the following options:
Language
: Choose the programming language you want to use (JavaScript or TypeScript).Style
: Choose the CSS preprocessor you want to use (Sass or Less).Unit testing library
: Choose the unit testing library you want to use (Jest or Karma).E2E testing library
: Choose the end-to-end testing library you want to use (Cypress or Protractor).
Choose the options that best fit your needs.
Step 4: Create the project
Once you've configured the project, the Angular CLI will create the project directory and initialize the project.
Step 5: Navigate to the project directory
Navigate to the project directory using the following command:
cd my-new-project
Step 6: Run the project
Run the project using the following command:
ng serve
This will start the development server and open the project in your default web browser.
That's it! You've created a new project in Angular 7.
Additional steps:
- To create a new component, run the following command:
ng generate component my-new-component
- To create a new service, run the following command:
ng generate service my-new-service
- To create a new module, run the following command:
ng generate module my-new-module
And so on...