search

Home  >  Q&A  >  body text

angular.js - Angular 2 写一 段 Hello 用 ng build 之后点HTML 不能加载

如图
1.
HTML 代码

2.这是TS 代码

3.输入 ng build 生成的文件

4.打开 HTML

一直不能运行
在ng server里就能显示HELLO

PHP中文网PHP中文网2744 days ago519

reply all(1)I'll reply

  • 阿神

    阿神2017-05-15 17:14:51

    This is because if you double-click to open index.html directly, <base href="/"> will affect the loading of all subsequent css and js.

    But if you add another sentence, it will cause APP_BASE_HREF exception and still cannot be accessed.

    The normal approach is to rely on a web service (such as IIS, Nginx, etc.) to ensure that resources are loaded normally.

    reply
    0
  • Cancelreply