J. Davidson
J. Davidson

Reputation: 3317

Angularjs Nested ng-repeat with conditional caluse

Hi i have situation were multiple ng-repeat are nested as

 <form  ng-repeat="pt in prolist">
Frequency <input  type="checkbox" ng-model="pt.req"  />
 <div ng-repeat="disc in prolist">
    ------
</div>
</form>

What I am trying to do is something like this

  <div ng-repeat="disc in prolist" where pt.id =disc.Pt_id>

Please let me know how to write this line of code in angularjs Thanks

Upvotes: 0

Views: 472

Answers (3)

Rishul Matta
Rishul Matta

Reputation: 3493

if your data set is huge then do the filtering in javascript and then push the objects to $scope.prolist to render that in view because filters affect the performance badly but for small data sets it is fine.

Upvotes: 0

Rahul
Rahul

Reputation: 562

You can filter repeaters in AngularJS. Try using filter, the following link displays how to use filters with ng-repeat.

ng-repeat with filter

Upvotes: 0

chbrown
chbrown

Reputation: 12026

You would basically turn that "where..." for into a filter pipe: http://docs.angularjs.org/api/ng/filter/filter

E.g., try:

ng-repeat="disc in prolist | filter:{Pt_id: pt.id}" ...

Upvotes: 3

Related Questions