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 >".
Then using "ng serve -o", we can run our project in browser. Here, -o flag is used for open in browser.
Once the process get completed, the result will be in command prompt.
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.
Open our Angular Project
To work on our angular project with visual studio code is easy. Please open Visual Studio Code on system.
In the middle section, click on "Open Folder" and pick your project folder.
Once you picked, visual studio code will load your angular project and it will look like below,
Alternatively, you can start your project in browser inside visual studio code's terminal. You can find it on the main menu.
Using terminal from vs code, you don't need to change directory. So, you can directly run "ng serve -o" command
Note:
In some cases, you may get below error/question asked from ng serve command.
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.
Alternatively, you can start the application by defining port yourself using --port flag.
In next section, we will enter into working with angular project.