I have two arrays.I want to match the values of an arrays using ng_if and else conditions as below:
var a = {'nishant','karan','jyotsna'};
var b = {'nishant','prbh','moh'};
<div ng-repeat="x in a">
<div ng-if="x!=b">
{{x}}
</div>
<div ng-else>
<div ng-repeat="x in b">
{{x}}
</div>
</div>
</div>
I think ngElse
is not a built-in directive, but you could just use another ngIf
.
http://plnkr.co/edit/HB7zK0Q8nGFRkj44U1AR?p=preview
<div ng-repeat="x in a">
<div ng-if="b.indexOf(x) !== -1">
{{x}} is in b
</div>
<div ng-if="b.indexOf(x) === -1">
{{x}} is not in b:
<div ng-repeat="x in b">
b: {{x}}
</div>
</div>
<hr/>
</div>