yodalr yodalr - 2 months ago 5
AngularJS Question

Angular 1: multiple conditions with multiple conditions OR how to exclude conditions if other conditions are true

Right now I have created an extra span to hold one condition.

<div ng-repeat="(key, resultLinks) in resultGroup.resultLinks">
<div ng-if="key < 4 || viewMore" ng-repeat="(subKey, linksWrap) in resultLinks.linksWrap">
<span ng-if="wWidth > 568 || subKey == 0" ng-repeat="links in linksWrap.links">
{{links.linkName}}
</span>
</div>
</div>


How would you change it so that all the conditions are in one div. Ie: ng-if="(key < 4 || viewMore) || (wWidth > 568 || subKey == 0)" (something like this, but not quite). Like is it possible to somehow exclude one condition if another is true?

Answer

Is this what you're looking for?

(key < 4 || viewMore) && (wWidth > 568 || subKey == 0)
Comments