运行Angular Cli Ng服务于https 2018

问题描述:

有没有一种方法可以通过https运行我的有角度的本地主机???我尝试了一些不同的教程,但Ive尝试了没有任何效果..

Is there a way I can run my angular localhost over https?? I have tried a few different tutorials but nothing has worked Ive tried.. serve your angular cli app over https but it would still serve over http:// has anyone succesfully done this? If so can you point me in the right direction?

谢谢

另一种选择,如果您没有证书,并且想要使用自签名进行测试,只需将标志"start": "ng serve --ssl",添加到package.json,在投放应用程序时会生成一个.

Another option, if you don't have a certificate and want to use a self-signed for testing purposes, just to add the flag "start": "ng serve --ssl", to the package.json, it will generate one when serving the app.

Angular CLI: 7.3.1
Node: 8.11.3
OS: win32 x64
Angular: 7.2.5

命令:

npm start

输出:

> ng serve --ssl
** Angular Live Development Server is listening on localhost:4200, 
open your browser on https://localhost:4200/ 
     10% building 4/4 modules 0 activei 「wds」: Generating SSL Certificate