Create new angular 7 project
Here are the steps to create a new Angular 7 project:
Using the Angular CLI
- Open a terminal or command prompt.
- Install the Angular CLI if you haven't already:
npm install -g @angular/cli
- Create a new project:
ng new my-new-project
(replace "my-new-project" with your desired project name) - Follow the prompts to choose the project template and configuration options.
- Once the project is created, navigate to the project directory:
cd my-new-project
- Run
ng serve
to start the development server and open the project in your browser.
Using the Angular CLI with a specific version
If you want to create a new project with a specific version of Angular, you can specify the version when running the ng new
command. For example, to create a new project with Angular 7, you can run:
ng new my-new-project --version=7
Using a code editor or IDE
If you prefer to create a new project using a code editor or IDE, you can use the following steps:
- Open your code editor or IDE (e.g. Visual Studio Code, IntelliJ IDEA, etc.).
- Create a new project by selecting the "Angular" template or choosing the "Angular" project type.
- Choose the project name, location, and other configuration options as prompted.
- Once the project is created, navigate to the project directory and run
ng serve
to start the development server and open the project in your browser.
Project structure
When you create a new Angular project, the Angular CLI will create a project structure with the following folders and files:
src
: This folder contains the source code for your application.app
: This folder contains the application code, including components, services, and other files.assets
: This folder contains static assets, such as images, fonts, and other files.environments
: This folder contains environment files, such asenvironment.ts
andenvironment.prod.ts
.karma.conf.js
: This file contains the configuration for the Karma test runner.tsconfig.json
: This file contains the configuration for the TypeScript compiler.package.json
: This file contains the project dependencies and scripts.