【发布时间】:2016-10-17 21:20:39
【问题描述】:
我使用 angular-cli 在 angular2 中开发了一个前端应用程序。
然后我使用ng build创建了包
我真正感兴趣的是我的应用程序仅包含 javascript 和 html 文件。
那我为什么需要服务器呢?
我的 angular2 应用程序应该直接从 index.html 运行,即双击 index.html。
不是吗?
谢谢
【问题讨论】:
标签: angular typescript
我使用 angular-cli 在 angular2 中开发了一个前端应用程序。
然后我使用ng build创建了包
我真正感兴趣的是我的应用程序仅包含 javascript 和 html 文件。
那我为什么需要服务器呢?
我的 angular2 应用程序应该直接从 index.html 运行,即双击 index.html。
不是吗?
谢谢
【问题讨论】:
标签: angular typescript
您需要使用服务器,因为 Chrome 等浏览器会限制从浏览器访问文件的方式。
您不需要特定的服务器,只需任何能够提供文件的 HTTP 服务器,这样浏览器就不需要直接访问它们。
【讨论】: