Support us .Net Basics C# SQL ASP.NET Aarvi MVC Slides C# Programs Subscribe Download

Angular cli ng serve options

Suggested Videos
Part 19 - Implementing routing in separate module in angular | Text | Slides
Part 20 - Angular CLI generate routing module | Text | Slides
Part 21 - Running angular app locally | Text | Slides

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 & 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

angular cli tutorial for beginners

No comments:

Post a Comment

It would be great if you can help share these free resources