<div ng-repeat="d in data" ng-if="data.length>0">
<div ng-bind="d.aa"></div>
<div ng-bind="d.bb"></div>
<div ng-if="d.test == 'true'">
<div ng-bind="it's test" />
</div>
</div>
</div>
内容:
- 我需要显示 d.test= true 表示,它就像测试一样。
- 通常ng-if工作正常,在ng-repeat和ng-bining中它不起作用。
请帮助这个
<div ng-repeat = "data in comments">
<div ng-if="data.length >0">
//different template with 0 data
</div>
<div ng-if="data.type == 'story' ">
//different template with story data
</div>
<div ng-if="data.type == 'article' ">
//different template with article data
</div>
</div>
您也可以使用
<li ng-repeat="r in results">
<!-- If r.date contains a value, show it -->
<span ng-if="r.date">{{r.date}}</span>
<!-- If r.date does not contain a value show placeholder text -->
<span ng-if="!r.date">Date not confirmed yet.<span>
</li>