Access to localhost from other machine - Angular

Two options are there

ng serve --host 0.0.0.0

To check, if this is not working, 1st try to hit from the same computer where you run ng serve, to get to know if you can access through the firewall

ng serve --host 192.168.X.X

192.168.X.X is the IP address of my pc(you can use ipconfig(windows), ifconfig(Linux) to see your IP) After that, you can access 192.1668.X.X:4200 instead of localhost:4200

Nothing related:- Even if you change some code and server refresh to show updated code, it will refresh in other machines too

If you can not able to access 192.168.X.X:4200. You may be in a network where firewall protection is blocking. SO, connect to your personal network and check


Using ng serve --host 0.0.0.0 command has solved my problem. Type 192.168.x.x:4200 to get access to the app from another machine.

Also, check for firewall rules on client and server (disable firewall temporally or create a rule to allow traffic)