如何在 codeanywhere IDE 中预览 angular 应用程序?
How to preview angular app in codeanywhere IDE?
虽然 运行 angular 应用程序在 codeanywhere
或 cloud9
中,但我们无法预览已编译的 angular 或任何其他网络应用程序。我们收到空白屏幕或一些错误消息。
要预览它,我们必须进行以下检查
- 请检查您的容器是否已打开并且运行
- 请确保您的服务器(angular)是运行和
listening on 0.0.0.0
IP地址。
(如果您正在侦听 127.0.0.1(本地主机),则无法从容器外部使用它)
- 您的服务器可能 运行 在不同的端口上,请检查您使用的端口是否正确。
并且请使用下面的命令来确保上述所有点都匹配以编译 angular 应用程序。
ng serve --host 0.0.0.0 --port 4201 --disable-host-check
这里的端口号4201是我选择的,请随意选择。
现在 codeanywhere IDE 可以在外面查看了。在某些情况下,您可能无法获得预览 url 以在浏览器中查看应用程序。如果是这样,我们必须找到预览 url。让我们看看下面如何构建它:
https://port-4201-containerName-username.preview.codeanywhere.com/
请根据您的IDE
自行替换下面提到的关键字
- 4201是你的端口号
- containerName是你容器的名称(项目环境)
- 用户名是codeanywhere用户名
This is not only for angular and applicable for all the web apps. Angular is an example here.
虽然 运行 angular 应用程序在 codeanywhere
或 cloud9
中,但我们无法预览已编译的 angular 或任何其他网络应用程序。我们收到空白屏幕或一些错误消息。
要预览它,我们必须进行以下检查
- 请检查您的容器是否已打开并且运行
- 请确保您的服务器(angular)是运行和
listening on 0.0.0.0
IP地址。 (如果您正在侦听 127.0.0.1(本地主机),则无法从容器外部使用它) - 您的服务器可能 运行 在不同的端口上,请检查您使用的端口是否正确。
并且请使用下面的命令来确保上述所有点都匹配以编译 angular 应用程序。
ng serve --host 0.0.0.0 --port 4201 --disable-host-check
这里的端口号4201是我选择的,请随意选择。
现在 codeanywhere IDE 可以在外面查看了。在某些情况下,您可能无法获得预览 url 以在浏览器中查看应用程序。如果是这样,我们必须找到预览 url。让我们看看下面如何构建它:
https://port-4201-containerName-username.preview.codeanywhere.com/
请根据您的IDE
自行替换下面提到的关键字- 4201是你的端口号
- containerName是你容器的名称(项目环境)
- 用户名是codeanywhere用户名
This is not only for angular and applicable for all the web apps. Angular is an example here.