【发布时间】:2014-10-16 00:50:17
【问题描述】:
我使用的是用 Yeoman 创建的 index.html,看起来像这样:
<html>
<head>...</head>
<body>
<div ng-include="'views/main.html'"></div>
</body>
</html>
现在,我知道我不能在另一个ng-include 中使用ng-include,所以我什至没有尝试过,但这是我想要实现的目标。
我在我的 main.html 中使用ui.router 用于嵌套视图,但我不能这样做:
<header class="header">
<!-- Rather long HTML code that I would like to put in
a separate file like 'views/parts/header.html' -->
</header>
<div ui-view="" class="container"></div>
一个天真的解决方案是删除第一个 ng-include 并在 main.html 中使用它作为页眉、页脚和类似的东西。
所以,用你所拥有的来打击我,但不要用那个!
编辑:这是我想要的(但不能,因为我已经在ng-include 中)
<div ng-include="'views/parts/header.html'"></div>
<div ui-view="" class="container"></div>
【问题讨论】:
标签: javascript angularjs angular-ui-router angularjs-ng-include