📅  最后修改于: 2023-12-03 14:39:12.436000             🧑  作者: Mango
Angular 7 First App
Angular is a JavaScript framework for building web applications. In this tutorial, we will guide you through the process of creating your first Angular 7 application.
Prerequisites
Before getting started, please ensure that you have the following installed on your machine:
- Node.js
- npm (Node Package Manager)
- Angular CLI (Command Line Interface)
Step 1: Setup
- Install Node.js from the official website: https://nodejs.org
- Open your terminal or command prompt and verify that Node.js and npm are installed by running the following commands:
node -v
npm -v
- Install Angular CLI globally by running the following command:
npm install -g @angular/cli
Step 2: Create a New Angular Project
- Open your terminal or command prompt and navigate to the folder where you want to create your Angular project.
- Run the following command to create a new Angular project:
ng new angular7-first-app
- Angular CLI will ask you a few questions. For simplicity, you can press Enter to accept the default options.
Step 3: Navigate to the Project
- Change to the project directory:
cd angular7-first-app
- Start the development server by running the following command:
ng serve
- Open your browser and navigate to http://localhost:4200. You should see the Angular welcome page.
Step 4: Modify the App
- Open the
src/app/app.component.html
file in your favorite code editor.
- Replace the existing HTML code with your own content.
<h1>Welcome to My Angular 7 App!</h1>
<p>This is my first Angular application.</p>
- Save the file.
Step 5: View the Modified App
- Go back to your browser and refresh the page. You should see the updated content on the screen.
Conclusion
Congratulations! You have successfully created your first Angular 7 application. Feel free to explore further and build more complex applications using Angular.