0

I have created a scope function like this

$scope.sample = [
   {'SUPNAME':'AAA','SUPCODE':'22671','SLIPNO':'18384','DESG':'1','iv':'1'},
   {'SUPNAME':'AAA','SUPCODE':'22671','SLIPNO':'18384','DESG':'2','iv':'2'},
   {'SUPNAME':'AAA','SUPCODE':'22671','SLIPNO':'18384','DESG':'3','iv':'3'},
   {'SUPNAME':'BBB','SUPCODE':'24603','SLIPNO':'26714','DESG':'1','iv':'4'},
   {'SUPNAME':'BBB','SUPCODE':'24603','SLIPNO':'26714','DESG':'2','iv':'5'},
   {'SUPNAME':'BBB','SUPCODE':'24603','SLIPNO':'26714','DESG':'3','iv':'6'},
]

I have to display by grouping with same SUPNAME,SUPCODE,SLIPNO. For example I have to display it like this.

SUPNAME:AAA  SUPCODE=22671
DESG 1  DESG2 DESG 3


SUPNAME:BBB   SUPCODE=24603
DESG 1  DESG2 DESG 3

So how can I create ng-repeat for this..Kindly give some solution.

4
  • try reformatting the whole sample data... This may speed the iterations. Otherwise you just loop, compare and paint Commented Jul 14, 2015 at 5:54
  • You'll need to group the data first. Sharing your research helps everyone. Tell us what you've tried and why it didn't meet your needs. This demonstrates that you've taken the time to try to help yourself, it saves us from reiterating obvious answers, and most of all it helps you get a more specific and relevant answer! Also see how to ask Commented Jul 14, 2015 at 5:55
  • you could simply filter for SupName or Supcode check this out should explain everything fdietz.github.io/recipes-with-angular-js/… Commented Jul 14, 2015 at 5:55
  • Ok first I will group the data and try it out Commented Jul 14, 2015 at 6:03

1 Answer 1

2

i tried to create a Codepen for your case

grouped Codepen

<table  class="table table-striped">
<tr><td>{{data1}}</td><td>{{data2}}</td></tr>
<tr ng-repeat="item in filteredsample = (sample | filter:{ SUPNAME: 'AAA'})">
</tr>
  <ul ng-repeat="thing in filteredsample">
<li style = "float:left; margin:20px">DESG VALUE {{$index}} = {{thing.DESG}}</li>
</ul>
</div>

Hope this helps

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.