Language:

Search

Initial Step in our Angular Project

  • Share this:
post-title

Start our project

 

After creating porject with "ng new < project name >" command, we need to change directory in command prompt and we can start the project by "ng serve -o".

In first, we need to change directory to our project by "cd < project name >".

2021-10-29 11_07_02-C__Windows_System32_cmd.exe-1
 

Then using "ng serve -o", we can run our project in browser. Here, -o flag is used for open in browser.

2021-10-29 11_31_31-ng serve -o
 

Once the process get completed, the result will be in command prompt.

2021-10-29 11_37_27-Windows PowerShell
 

You can see http://localhost:4200/ in the above screenshot. This is the URL of our angular project can be accessed in browser. With -o flag, this URL will open in browser automatically when the "ng serve -o" completed.

In the browser, the result will be look like below because it is a scratch.

2021-10-29 12_13_36-Get Started - test - Visual Studio Code
 

Open our Angular Project

 

To work on our angular project with visual studio code is easy. Please open Visual Studio Code on system.

2021-10-29 12_17_19-Get Started - Visual Studio Code
 

In the middle section, click on "Open Folder" and pick your project folder.

2021-10-29 12_21_26-Get Started - Visual Studio Code
 

Once you picked, visual studio code will load your angular project and it will look like below,

2021-10-29 12_24_09-test - Visual Studio Code
 

Alternatively, you can start your project in browser inside visual studio code's terminal. You can find it on the main menu.

2021-10-29 12_27_15-test - Visual Studio Code
 

Using terminal from vs code, you don't need to change directory. So, you can directly run "ng serve -o" command

2021-10-29 12_39_53-test - Visual Studio Code
 

Note:

In some cases, you may get below error/question asked from ng serve command.

2021-10-29 12_34_01-test - Visual Studio Code
 

It means that the specified port already used by another application. In this case, you can proceed with 'Y' for "Would you like to use a different port?".

Then your application will be started with another available port by ng serve.

2021-10-29 12_36_22-test - Visual Studio Code
 

Alternatively, you can start the application by defining port yourself using --port flag.

2021-10-29 12_48_26-test - Visual Studio Code
 

In next section, we will enter into working with angular project.

 

Previous Topic  Next Topic

Siva P SV

Siva P SV

I am developer and blogger. I am experienced in PHP, .NET, Android, Ionic, I know these kind of language. Because, I would like to learn new things in this world. I am still learning much more things. Oh, I forgot to mention that I am also one of the Co-Founders of Tuty Rocks