【问题标题】:Using ng-include With IIS在 IIS 中使用 ng-include
【发布时间】:2015-07-17 21:09:43
【问题描述】:

以下 ng-include 标记适用于开发人员框,但不适用于 IIS 网站,因为它在输出中不包含网站名称。

<div ng-include="'/app/feature/list.html'" />

在运行 IISExpress 的开发人员机器上,这会构建一个 url:http://localhost:49716/app/feature/list.html 并且运行良好。

部署到 IIS 时,URL 为:http://server/app/feature/list.html。这不起作用,因为该站点被命名并在 /site 上提供服务。预期的网址是http://server/site/app/feature/list.html。这会导致 404 和损坏的网站。

Angular 不应该能够建立相对于网站本身的真实路径吗?有没有办法让 Angular 做到这一点而无需将其作为配置注入?

【问题讨论】:

    标签: javascript angularjs iis


    【解决方案1】:

    我的问题是来自 url 的斜线。斜线表示绝对路径而不是相对路径。这个 ng-include 有效:

    <div ng-include="'app/feature/list.html'" />
    

    【讨论】:

      猜你喜欢
      • 2016-09-04
      • 2015-12-22
      • 1970-01-01
      • 1970-01-01
      • 2018-03-27
      • 2017-08-25
      • 2016-01-30
      • 1970-01-01
      • 2014-06-15
      相关资源
      最近更新 更多