How can I get 'ng serve -o' to launch a page other than index.html?

So I don't think angular cli supports opening an arbitrary page with the -o option, but you could make your own npm script that does what you want.

Try opening package.json and editing the scripts section to update the start script like so (mac version):

"scripts": {
    "ng": "ng",

    // where localhost:4200 is your dev host and port, respectively
    "start": "ng serve && open http://localhost:4200/host.html",

    "build": "ng build",
    ...
  },

Depending on what platform you're using, the script would need to be written differently:

// Windows
"start":"ng serve & start http://localhost:4200/host.html"

// Mac
"start":"ng serve && open http://localhost:4200/host.html"

// Linux 
"start":"ng serve && xdg-open http://localhost:4200/host.html"

Then, instead of using ng serve to start your app, use npm start.

Reference: used this SO answer for the platform specific open commands.

Tags:

Angular Cli