Reputation: 6481
I have some Angular code which uses nested ng-repeat like this:
<div ng-repeat="sym in transData.trades | unique:'Symbol'">
{{sym.Symbol}}
<div ng-repeat="trans in transData.trades | filter: { Symbol: 'ParentValue' } | orderBy: ['Action']">
<span>{{trans.Action}}</span>
<span>{{trans.TxnId}}</span>
<span>{{trans.Quantity}}</span>
<span>{{trans.Price}}</span>
<span>{{trans.MarketValue}}</span>
</div>
</div>
I want to filter the second ng-repeat by the parent ng-repeat's scope value {{sym.Symbol}} (that's what ParentValue is representing in the second ng-repeat). How can I do that? Using filter: { Symbol: {{$parent.sym.Symbol}} }
does not work.
Upvotes: 0
Views: 102
Reputation: 222582
Just use sym.Symbol
,
<div ng-repeat="sym in transData.trades | unique:'Symbol'">
{{sym.Symbol}}
<div ng-repeat="trans in transData.trades | filter: {trans : {Symbol: sym.Symbol}} | orderBy: ['Action']">
<span>{{trans.Action}}</span>
<span>{{trans.TxnId}}</span>
<span>{{trans.Quantity}}</span>
<span>{{trans.Price}}</span>
<span>{{trans.MarketValue}}</span>
</div>
</div>
Upvotes: 1