1

I'm trying to access my localhost on my iphone to test my angular app but I can't get it to work. Anyone else figure this out?

I'm on a mac and my npm script looks like this

"start": "ng serve -e=local --host 0.0.0.0 --public --port 8000 --ssl",

and I'm trying to hit http://mymac.local:8000 on my phone, but it doesn't work

zer0
  • 4,657
  • 7
  • 28
  • 49

1 Answers1

2

I ran into the same issue. The workaround is to use the --prod flag while serving your angular application. Ex: ng serve --prod --host<Your IP> P.S: This obviously takes more time(due to prod) to build and more time to reflect changes while debugging

Danish Aziz
  • 475
  • 5
  • 14
  • 1
    It didn't work for me (for crazy error), but anyway, thank you for the great idea. In my case I've ended up for making a build `ng build`, and then accessed it with any web server (e.g. Apache) like localhost/myproject/dist (on iPhone, accordingly, it was similar to http://192.168.0.102/myproject/dist) – Maxím G. Aug 03 '19 at 09:55