AngularJs:NG-包括放置在NG-视图标签内不工作时 [英] AngularJs: ng-include not working when placed inside a ng-view tag
本文介绍了AngularJs:NG-包括放置在NG-视图标签内不工作时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我通过NG-视图中角路线加载HTML页面。
这我加载该页面包含一个NG-包括标签,指向
另一个HTML文件。
I am loading a html page via angular route inside a ng-view. The page which I am loading contains a ng-include tag, pointing to another html file.
我试过下面的语法=
<div ng-include src="'some.jsp'"></div>
<div ng-include="'login.jsp'"></div>
<div ng-include src="include.url"></div>
无工作。但是如果我把同一个变量在NG-视图之外
其工作的罚款。
None working. But If I put the same tag outside the ng-view its working fine.
我在做什么错了?
推荐答案
的URL文件应该是相对于你的index.html(主HTML文件)。
如果你的结构是这样的:
The url to the file should be relative to your index.html (main html file). If your structure is like this:
index.html
template
template1.html
template2.html
和中的template1要NG-包括template2.html,
你应该做的。
and in template1 you want to ng-include template2.html, you should do
<div ng-include="'template/template2.html'"></div>
这里是一个工作的例子。
这篇关于AngularJs:NG-包括放置在NG-视图标签内不工作时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文