Angular-cli: Ability to specify browser to open with ng serve --open

Created on 19 Mar 2017  Â·  4Comments  Â·  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [x] feature request

Versions.

==> ng --version 
    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / â–³ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/
@angular/cli: 1.0.0-rc.2
node: 6.10.0
os: linux x64
@angular/common: 2.4.10
@angular/compiler: 2.4.10
@angular/core: 2.4.10
@angular/forms: 2.4.10
@angular/http: 2.4.10
@angular/platform-browser: 2.4.10
@angular/platform-browser-dynamic: 2.4.10
@angular/router: 3.4.10
@angular/cli: 1.0.0-rc.2
@angular/compiler-cli: 2.4.10

Repro steps.


ng serve --open

The log given by the failure.


NA

Desired functionality.


The use case is to make it convenient for a developer to use a different browser for development than for daily browsing.

I would like to be able to set the browser that is opened - similar to the way live-server allows.
https://www.npmjs.com/package/live-server

For example, in file ~/.live-server.json, I have:

{
  "browser": "google-chrome",
  "wait": 100
}

Mention any other details that might be useful.

3 (nice to have) feature

Most helpful comment

Thanks for sharing your idea! This is out of the scope for now. As a workaround, I'd recommend you to do something like this in your package.json:

"scripts": {
  "start": "ng serve && open http://localhost:4200"
}

Hope this works for you! Alternatively, look at ngx-build-plus.

All 4 comments

Something to note about the option is that it is not cross-platform which can make it very awkward to use with a group of developers.
For example, Chrome is google-chrome on linux, google chrome on mac, and chrome on windows.

That's true, and it's the reason I called out the ability to have a config file in your home directory. I agree that a project setting wouldn't be as useful.

Thanks for sharing your idea! This is out of the scope for now. As a workaround, I'd recommend you to do something like this in your package.json:

"scripts": {
  "start": "ng serve && open http://localhost:4200"
}

Hope this works for you! Alternatively, look at ngx-build-plus.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MateenKadwaikar picture MateenKadwaikar  Â·  3Comments

JanStureNielsen picture JanStureNielsen  Â·  3Comments

IngvarKofoed picture IngvarKofoed  Â·  3Comments

brtnshrdr picture brtnshrdr  Â·  3Comments

ericel picture ericel  Â·  3Comments