Angular cli ng serve options04:33

  • 0
Published on November 29, 2017

In this video we will discuss some of the common options that we can use with ng serve command.

To see the list of all options that we can use with “ng serve” command use –help option
ng serve –help

The following page also shows all the options that can be used with ng serve

The following command, builds and launches the application in your default browser.
ng serve –open

Many of our channel subscribers have sent me emails saying their application is using Internet Explorer, but they want to use Google chrome instead. So thier question is how to change my default browser. Well that’s simple and it really depends on the operating system you have. For example, on a Windows 7 operatin system here are the steps to change your default browser.
1. Click on the Windows Start Button and in the “Search programs and files” text box type: Control
2. Control Panel would appear in the list. Click on it.
3. In the “Control Panel” window, click on “Default Programs”
4. In the “Default Programs” window, click on “Set your default programs”
5. In the list of programs that appear, select the “Browser” that you want to be the default browser and then click on the link that says “Set this program as default”

That’s it. At this point, execute “ng serve –open” command and you will have your application launched in your specified default browser.

Instead of using the full option name –open, you can also use it’s alias -o

The following table shows the common options, alias, default value and their purpose
Option Alias Default Purpose
–watch -w true Run build when files change
–live-reload -lr true Whether to reload the page on change
–open -o false Opens the url in default browser
–port -p 4200 The port on which the server is listening
–extract-css -ec Extract css from global styles onto css files instead of js ones

Text version of the video

Slides

Angular CLI Tutorial

Angular CLI Text articles & Slides

All Dot Net and SQL Server Tutorials in English

All Dot Net and SQL Server Tutorials in Arabic

Enjoyed this video?
"No Thanks. Please Close This Box!"