How to test an app created with Angular CLI ng serve from another device?

angular, angular-cli, networking

Solution

Adding the host-flag with value "0.0.0.0" should allow you to access the webserver from any device on your local network.

This should work: `ng serve --host 0.0.0.0`

For an explanation: https://github.com/angular/angular-cli/pull/1475#issuecomment-235986121

Problem

I have an app generated with Angular CLI from scratch. CLI version `angular-cli: 1.0.0-beta.11-webpack.2` I am trying to test it from my smartphone but I get Connection refused. So, I run `ng serve` on my laptop and try to access the app: - From laptop, using `localhost`: Works - From laptop, using IP: Connection refused - From smartphone, using IP: Connection refused This used to work with the previous, SystemJS version of CLI. I checked that I don't have a firewall running. How could I fix or debug this error? I am using a Mac.

Original source