javascript - Display the group values using angular js..? -


now have created script this.

$scope.newsample = {      1 : [     {'supname' : 'habib','pkslip' : '17193','prdcode' : '52003','itmdesg' : '2550','itmcode' : 'iac1552072','iv' : '1'},     ],     2 : [     {'supname' : 'ekjot','pkslip' : '55414','prdcode' : '52236','itmdesg' : '420','itmcode' : 'ibd5243688','iv' : '2'},     {'supname' : 'ekjot','pkslip' : '55414','prdcode' : '52236','itmdesg' : '426','itmcode' : 'ibd5243661','iv' : '3'},     {'supname' : 'ekjot ','pkslip' : '55414','prdcode' : '52236','itmdesg' : '428','itmcode' : 'ibd5243709','iv' : '4'},     ],     3 : [     {'supname' : 'jaysons','pkslip' : '50225','prdcode' : '53554','itmdesg' : '6089','itmcode' : 'ibc4745296','iv' : '5'},     ] } $scope.total = [     {'iv' : '1'},     {'iv' : '2'},     {'iv' : '3'},     ] 

now how can display in format.

supname:habib  pkslip:17193 itmdesg:iac1552072  supname:ekjot   pkslip=55414 itmdesg:ibd5243688  itmdesg:ibd5243661 itmdesg3:ibc4745296  supname:jaysons  pkslip:50225 itmdesg:ibc4745296 

i have tryed this,but supname repeating give idea how can use ng-if skip same supname. need display supname once , corresponding itmdesg should displayed in grouped format.

<div ng-repeat="tot_grp in total " ng-init="subval=newsample[tot_grp.iv]">     <div ng-repeat = "grp_val in subval">         <div>         <label>{{{{grp_val.supname}}}}</label>         <label>{{{{grp_val.pkslip}}}}</label>         </div>         <div style="clear:both"></div>         <div>         <label>{{{{grp_val.itmdesg}}}}</label>         </div>     </div> </div> 

you use $first inner ng-repeat

markup

<div ng-repeat = "grp_val in subval">     <div ng-if="$first">       <label>{{grp_val.supname}}</label>       <label>{{grp_val.pkslip}}</label>     </div>     <div style="clear:both"></div>     <div>     <label>{{grp_val.itmdesg}}</label>     </div> </div> 

Comments