【发布时间】:2016-02-14 05:10:24
【问题描述】:
我正在关注本教程:http://campus.codeschool.com/courses/shaping-up-with-angular-js/level/4/section/1/video/1
我唯一不同的是在我的文件结构中添加了一个文件夹。 即使我将其删除并将“product-title.html”与我的 index.html 一起放在根目录中,它也不起作用。
<h3 ng-include="'includes/product-title.html'"></h3>
这看起来很简单,我做错了什么吗?
product-title.html中的代码是:
{{product.name | uppercase}}
<em class="pull-right">{{product.price | currency}}</em>
我正在使用以下依赖项:
"dependencies": {
"angular": "^1.4.7",
"bootstrap": "^3.3.5"
}
【问题讨论】:
-
你必须放完整路径而不是相对路径
-
我也试过了。不走运.. ng-include="'/includes/product-title.html'"
-
你能显示你的目录结构吗?
-
也是错误productController not found吗?
-
添加了结构。我遇到的错误是:XMLHttpRequest 无法加载 file:///C:/includes/product-title.html。跨源请求仅支持协议方案:http、data、chrome、chrome-extension、https、chrome-extension-resource。
标签: javascript angularjs include frontend