H. Pauwelyn H. Pauwelyn - 5 months ago 52
Android Question

How to run my Angular site on mobile device that is running localhost on my windows desktop

I know from this question and answer on Super User Site running on localhost on desktop is unreachable on android device (PS: this question continues on the question in the link) that the command

ng serve
opens a bad configured webserver.

The question is how could I run my site on an Android device without deploying my site. I'll try to run the site on this url
using Angular-CLI.

Answer Source

try ng serve --host option as explained in this issue: https://github.com/angular/angular-cli/issues/1793 comment by intellix.

  1. ng serve --host
  2. Find your local ip address by following this
  3. Navigate to <local ip adress>:4200 from any device on the same network.

otherwise try https://ngrok.com/ to open a tunnel from your local network to your computers localhost. Basically your computer forwards the 4200 port to an external ip and port that any device on the network can access.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download