How to allow access outside localhost

后端 未结 15 846
失恋的感觉
失恋的感觉 2020-12-07 07:25

How can I allow access outside the localhost at Angular2? I can navigate at localhost:3030/panel easily but I can not navigate when I write my IP such as

15条回答
  •  感情败类
    2020-12-07 08:16

    Using ng serve --host 0.0.0.0 will allow you to connect to the ng serve using your ip instead of localhost.

    EDIT

    In newer versions of the cli, you have to provide your local ip address instead

    EDIT 2

    In newer versions of the cli (I think v5 and up) you can use 0.0.0.0 as the ip again to host it for anyone on your network to talk to.

提交回复
热议问题