使用ng-repeat在Angular Bootstrap中显示动态导航时出错。折叠导航无法正常工作。
我的代码是:
<ul>
<li ng-repeat="menu in menus.menus">
<a href="javascript:void(0);">
<span class="menu-item-parent">{{menu.name}}</span>
</a>
<ul class="sub-left-nav" >
<li ng-repeat="submenu in menu.submenu">
<a href="#/{{submenu.url}}" target="open_frame">{{submenu.name}}</a>
</li>
</ul>
</li>
</ul>
在我的控制器中:
$scope.menus = {
"menus": [
{
"name": "Master Maintenance",
"submenu": [
{
"name": "CropType",
"url": "croptype"
},
{
"name": "CropMaster",
"url": "crop"
}
]
}
]
}
当我不使用ng-repeat和json并且只使用静态导航时,一切正常。
<ul>
<li>
<a href="javascript:void(0);" title="Dashboard"><span class="menu-item-parent">Link 1</span></a>
</li>
<li class="active">
<a href="javascript:void(0);"><span class="menu-item-parent">Link 2</span></a>
<ul class="sub-left-nav">
<li class="active">
<a href="javascript:void(0);" target="open_frame">Sub Link 1</a>
</li>
<li>
<a href="javascript:void(0);" target="open_frame">Sub Link 2</a>
</li>
<li>
<a href="javascript:void(0);" target="open_frame">Sub Link 3</a>
</li>
</ul>
</li>
</ul>
答案 0 :(得分:1)
<强>更新强>
问题不明确,让我想到了一个拼写错误......请参阅评论。