【发布时间】:2015-02-25 01:42:52
【问题描述】:
我的angular项目的路径是这样的
web
server.py ##flask server program
app
static
app.js
controllers.js
etc...
templates
index.html
home.html
index.html
<!-- this didn't work -->
<ng-include src="templates/home.html"><ng-include>
<!-- nor did this -->
<ng-include src="home.html"></ng-include>
home.html
<h1> home! </h1>
除了我在输出中没有看到部分 (home.html)。
有人看到我的错误吗?
【问题讨论】:
-
您没有传递文件路径。您传递要包含的部分的 URL。就像您在
<a href="...">或<img src="...">中一样。因此,请查看地址栏中的 URL,并使用相对或(更好的)绝对路径指向要加载的部分。 -
"使用相对路径或(更好的)绝对路径" > 为什么使用绝对路径会更好?对我来说,看起来我们并不完全确定那里发生了什么。我想使用相对路径应该更好,因为它更可重用。
标签: html angularjs filepath partials angularjs-ng-include