如果子li
为空,我想隐藏父li
。以下是我要隐藏父li
标签TWO的jsfiddle link。
<ul id='ListNav'>
<li ng-repeat='mainList in lists.list' ng-hide='subList.length<0' >
<a>{{mainList.label}}</a>
<ul>
<li ng-repeat='subList in mainList.subList'>{{subList.label}}</li>
</ul>
</li>
</ul>
答案 0 :(得分:0)
要解决此问题,只需更改:
<li ng-repeat='mainList in lists.list' ng-hide='subList.length<0' >
要
<li ng-repeat='mainList in lists.list' ng-show="mainList.subList.length>0" >
答案 1 :(得分:0)
您无法在该级别使用subList
尝试将其更改为mainList.subList
<ul id='ListNav'>
<li ng-repeat='mainList in lists.list' ng-hide='mainList.subList.length==0'> <a>{{mainList.label}}</a>
<ul>
<li ng-repeat='subList in mainList.subList'>{{subList.label}}</li>
</ul>
</li>
</ul>