23.11.2022 |

Test how your Angular application works on a real mobile device during development

Both your development machine and your mobile device need to use the same Wi-Fi network.

  1. Start your application with --host 0.0.0.0 --disable-host-check
ng serve --host 0.0.0.0 --disable-host-check
  1. Check your local IP address (Linux, macOS)
ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'

Example response:

192.168.178.97 # this one is the important one
192.130.102.159
  1. Open your mobile device's web browser and open the website on <development-machine-ip-address:port>

Example:

Angular usually runs on port 4200. My Mac/Linux machine has the IP address 192.168.178.97.
That's why I have to navigate to 192.168.178.97:4200 in my cellphone's web browser.

Sophia
Zur Übersicht

Mehr vom DevSquad...

Adrian Görisch

SEEK vs OFFSET

Jan Sauer

PAW ist jetzt RapidAPI