我正在通过 ng-view 中的 Angular 路径加载 html 页面。 我正在加载的页面包含一个 ng-include 标记,指向 另一个 html 文件。
我尝试了以下所有语法 =
<div ng-include src="'some.jsp'"></div>
<div ng-include="'login.jsp'"></div>
<div ng-include src="include.url"></div>
没有工作。但是如果我把相同的标签放在 ng-view 之外 它工作正常。
我做错了什么?
最佳答案
该文件的 url 应该与您的 index.html(主 html 文件)相关。 如果你的结构是这样的:
index.html
template
template1.html
template2.html
在 template1 中你想要 ng-include template2.html, 你应该做
<div ng-include="'template/template2.html'"></div>
Here是一个工作示例。
关于javascript - AngularJs:当放置在 ng-view 标签内时,ng-include 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24059749/