I need to use a variable as the condition in the ng-if directive, which is set in parent div using ng-init.
<div ng-repeat="item in list" ng-init="flag = false">
<div>
<div ng-if="item == a" ng-init="flag = true">
<!-- Some html code -->
</div>
<div ng-if="item == b" ng-init="flag = true">
<!-- Some html code -->
</div>
</div>
<div ng-if="flag == false">
<!-- Some html code -->
</div>
</div>
Can anyone tell me how to get this done?
Edit
I wanted to check whether each item in a list (list_a
) is present in another list (list_b
).
And for each item in list_a
, display one div if present or display another div if not present in list_b
.