Getting Started!
- Generate an Angular application
Learn how to use the Angular CLI to generate an Angular application.
- Run the application
Launch the application locally and view the default base page.
- Understand hot reloading
Understand how hot reloading works in Angular applications.
Create the project
Angular provides a Command Line Interface (CLI) to generate a new Angular application, manage the project, and run the application locally.
-
Open a terminal and run the following command to create an Angular application:
Terminal window npm create @angular@latest angular-introduction-course --style=css --ssr=false --skip-tests=true
The command includes some options to facilitate the learning process. Learn more about the options in Angular CLI Options.
Open the project
-
Open Visual Studio Code.
-
Click on the
File
menu and selectOpen Folder
. -
Navigate to the
angular-introduction-course
folder and click theSelect Folder
button.
Run the application
The Angular CLI provides a command to launch the application locally.
-
Open Visual Studio Code’s terminal.
-
Type the following command to start the application:
Terminal window ng serve -
Open your browser and navigate to
http://localhost:4200
. -
You should see the following default base page:
Hot Reloading
Hot reloading is a feature that allows you to see the changes you make to your code without having to manually refresh the page.
-
Open the
src/app/app.component.html
file. -
Replace the entire content of the file with the following code:
app.component.html <header><h1>Angular Legacy course</h1></header> -
Return to your browser to see the following page: