【发布时间】:2017-12-05 01:24:26
【问题描述】:
我了解了 ng-include 并将其用于模板,但我无法包含该页面。
index.html和menu.html在同一目录下,menu.html要加载到index.html中
<ng-include src="'menu.html'"></ng-include>
我已在 index.html 中包含应用程序的名称。 我想在页眉和页脚之间包含 menu.html。所以我删除了 menu.html 中的所有内容,除了我想要包含的容器 div。链接和引用也已在 index.html 中正确设置
我真的被困在这里了。请帮帮我!谢谢。
编辑: 这是我的项目结构 -
Project-
app-
fonts-...
images-...
scripts-
app.js
controllers.js
services.js
styles-...
index.html
menu.html
...
编辑-2
我刚刚发现当我更改浏览器时,即从 chrome 到 firefox,它加载成功!现在为什么会发生这种情况?
【问题讨论】:
-
你可以试试
ng-includeas<div ng-include=" 'menu.html' "></div> -
@Maher 试过了。还是一样。
-
好的,现在让我们看看您的应用程序结构,您能否通过将其添加到问题中来改进您的问题?
-
另一种方法,从应用的根目录设置 url,例如
ng-include=" '/Application/vendor/menu.html' " -
请问您是否检查了您的控制台,是否有任何消息或错误?
标签: angularjs angularjs-ng-include angularjs-templates