HI WELCOME TO SIRIS

Angular cli ng serve options

Leave a Comment

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
https://github.com/angular/angular-cli/wiki/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
OptionAliasDefaultPurpose
--watch-wtrueRun build when files change
--live-reload-lrtrueWhether to reload the page on change
--open-ofalseOpens the url in default browser
--port-p4200The port on which the server is listening
--extract-css-ecExtract css from global styles onto css files instead of js ones

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.