vamsikrishnamannem
vamsikrishnamannem

Reputation: 4847

how to use ng-repeats in ng-repeat with ng-if

I am trying to do following but it's not working.

<div ng-repeat="a in ar">
    <div ng-repeat="b in br">
        <div ng-if="a.num == b.num">{{b.type}}
        </div>
    </div>
</div>

I am trying to do array objectives comparing same values arrays is

ar = [ {num:1, str:"a"}, {num:2, str:"b"}, {num:3, str:"c"} ];
br = [ {num:3, type:"text"}, {num:5, type:"number"}, {num:8, type:"date"}];

Upvotes: 0

Views: 93

Answers (1)

acg
acg

Reputation: 961

It is working, its creating the outside divs, you can see it if you add a reference to the a items:

<div ng-repeat="a in ar">
    {{a.str}}
    <div ng-repeat="b in br">
        <div ng-if="a.num == b.num">
            {{b.type}}
        </div>
    </div>
</div>

Upvotes: 1

Related Questions