How to test an app created with Angular CLI ng serve from another device?

前端 未结 5 1900
轮回少年
轮回少年 2021-02-02 07:37

I have an app generated with Angular CLI from scratch. CLI version angular-cli: 1.0.0-beta.11-webpack.2

I am trying to test it from my smartphone but I get

5条回答
  •  既然无缘
    2021-02-02 08:13

    you have to find in node_modules angular cli folder all the occurences of localhost and replace (one in particular, depending of your angular-cli version) with 0.0.0.0.

    then in package.json put ng serve --host 0.0.0.0

    In my case the file is commands/serve.js

提交回复
热议问题