In this tutorial, I’ll be sharing how to install Angular on your local machine and how to create and run your first Angular Application.
Table of Contents
Installation
Angular Global Installation
Create Your First Angular Application
Run Your Fist Angular Application
Step 1. Installation
- Download and install Node.js ( Download Link )
- Download and install VS Code ( Download Link )
- Download and install Git Bash ( Download Link )
In every installation, read and follow the instructions.
We will be using Git Bash in VS Code.
Step 2. Angular Global Installation
- Open a Command prompt and type:
npm install -g @angular/cli
- To check the installed version of Angular in your local machine type:
ng version
Step 3. Create Your First Angular Application
- Create a folder named Angular Samples on your drive c or d
- In Command prompt cd to the location folder that you created and type:
ng new <Project_Name>
After hitting ender, It will ask if you want to add angular routing and you may choose Y or N. If N you may set it up manually later. Next, it will ask you what stylesheet you want to use css, scss and so forth. In my case I chose scss.
Wait for the project creation and dowmload to finish
Step 4. Run Your First Angular Application
- After the creation of the project, cd to ng-basics or the name of your project. In my case :
d:\Angular Samples>cd ng-basics
d:\Angular Samples\ng-basics>code .
- After hitting enter after typing code space dot (code .) your project in Visual Studio Code will open.
- Open the terminal in visual studio by clicking Terminal in the top navigation menu or do the following shortcut:
Ctrl + Shift + `
- As I’ve mentioned, we’ll use Git Bash in VS Code. To open up Git Bash terminal in VS Code, on your lower right click the dropdown sign beside + sign button and choose Git Bash
- Git Bash Terminal will show then the type:
ng serve
ng serve -o
Adding -o to the command, the application with automatically open to the browser.
Without the -o you need to navigate the url http://localhost:4200/
Congratulations! Your first Angular Application run successfully!
This is just the beginning, Follow for more contents!
I hope this help!
Have a blessed day!