2016-11-04 68 views
0

我想包括一个模板,它不工作。我有麻烦,包括每一次我尝试使用它们。有什么我做错了吗?angularjs:ng-include不能在另一个视图中工作

意见结构:

https://i.stack.imgur.com/yFeYs.png

UserList.html:

<p> 
    UserList 
</p> 
<div ng-include src="'../Partials/Paging.html'"></div> 

更新:

Paging : localhost/Administrator/App/Views/User/UserList.html 
UserList : localhost/Administrator/App/Views/Partials/Paging.html 
Index : localhost/Administrator/Index.html 
+0

哪里是你的index.html?尝试用'src =“Partials/Paging.html”' – murli2308

+0

分页:http://localhost/Administrator/App/Views/Partials/Paging.html ----和index:http:// localhost/Administrator/Index。 html – mywindowshosting2016

+0

请尝试我的回答中给出的路径是否正确 – Nitheesh

回答

0

尝试

<div ng-include="'App/Views/Partials/Paging.html'"></div> 

ng-include不需要src参数。如果仍然看到任何错误,请验证路径Paging.html

+0

没有工作...此代码:'

'在Index.html中工作为什么? – mywindowshosting2016

+0

看到我上面的答案。包含路径相对于您的index.html被解析。 – dbarthel

+0

您目前位于管理员文件夹内。您需要从当前位置进入App/Views/Partials/Paging.html。所以这个url路径是必需的 – Nitheesh

0

试试这个

<div ng-include="'../Partials/Paging.html'"></div> 

,直到你不会得到SRC路径可能是错误的

0

include路径在您的index.html开始,因为它在运行SPA时从那里装载。 所以你的include路径必须是相对于您的index.html:

<div ng-include="'App/Views/Partials/Paging.html'"></div> 
相关问题